State Farm Distracted Drivers

Prev Exercises: Udacity:DeepLearning:TensorFlow:notMNIST

Fit Logistic Regression SGD with random image rotation (TensorFlow)

In [1]:
import sys
print sys.version

from joblib import Parallel, delayed  
import multiprocessing
nCores = multiprocessing.cpu_count() - 2 # Allow other apps to run
print 'nCores: %d' % (nCores)

from datetime import datetime, time
print 'now: %s' % str(datetime.now())
2.7.11 (default, Jan 28 2016, 14:07:46) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
nCores: 14
now: 2016-05-23 08:15:24.694001
In [2]:
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import display, Image
import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
from rpy2.robjects.lib import grid
from rpy2.robjects.lib import ggplot2
import rpy2.robjects.pandas2ri

import numpy as np
np.set_printoptions(precision=4, suppress=True)
import os
import pandas as pd
from scipy import ndimage
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle

import tensorflow as tf
print 'tf.__version__:%s' % str(tf.__version__)

%run img_utils.py
tf.__version__:0.8.0
/usr/local/lib/python2.7/site-packages/rpy2/robjects/lib/ggplot2.py:59: UserWarning: This was designed againt ggplot2 version 2.0.0 but you have 2.1.0
  warnings.warn('This was designed againt ggplot2 version %s but you have %s' % (TARGET_VERSION, ggplot2.__version__))

Analytics Specs

This Project

In [3]:
%run img_glbSpec_SFDD_ImgSz_64.py
imported img_glbSpec_SFDD_Img_Sz_64.py
In [4]:
# print '\nglbDataFile: %s' % (glbDataFile)

print '\nglbRspClass: %s' % (glbRspClass)
print 'glbRspClassN: %d' % (glbRspClassN)
print 'glbRspClassDesc: '; print(glbRspClassDesc)

print '\nglbImg:'; print(glbImg)

print '\nglbTfwVarSeed: %d' % (glbTfwVarSeed)

print '\nglbPickleFile: %s' % (glbPickleFile)
glbRspClass: ['c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9']
glbRspClassN: 10
glbRspClassDesc: 
{'c9': 'talking to passenger', 'c8': 'hair and makeup', 'c3': 'texting - left', 'c2': 'talking on the phone - right', 'c1': 'texting - right', 'c0': 'normal driving', 'c7': 'reaching behind', 'c6': 'drinking', 'c5': 'operating the radio', 'c4': 'talking on the phone - left'}

glbImg:
{'color': False, 'crop': {'x': (80, 560)}, 'shape': (480, 640, 3), 'pxlDepth': 255.0, 'center_scale': True, 'size': 64}

glbTfwVarSeed: 131

glbPickleFile: {'models': 'data/img_M_SFDD_ImgSz_64.pickle', 'data': 'data/img_D_SFDD_ImgSz_64.pickle'}

Import Data

This Project

In [5]:
%run img_utils.py
glbObsFitIdn, glbObsFitFtr, glbObsFitRsp, \
glbObsVldIdn, glbObsVldFtr, glbObsVldRsp, \
glbObsNewIdn, glbObsNewFtr, glbObsNewRsp, \
sbtNewCorDf, \
_ = myimportDbs(glbPickleFile['data'])

glbObsTrnIdn = glbObsFitIdn + glbObsVldIdn
glbObsTrnFtr = np.vstack((glbObsFitFtr, glbObsVldFtr))
glbObsTrnRsp = np.concatenate((glbObsFitRsp, glbObsVldRsp))

print('Fit pickled set:', 
      len(glbObsFitIdn), glbObsFitFtr.shape, glbObsFitRsp.shape)
print('Vld pickled set:', 
      len(glbObsVldIdn), glbObsVldFtr.shape, glbObsVldRsp.shape)
print('Trn pickled set:', 
      len(glbObsTrnIdn), glbObsTrnFtr.shape, glbObsTrnRsp.shape)    
print('New pickled set:', 
      len(glbObsNewIdn), glbObsNewFtr.shape, glbObsNewRsp.shape)
Importing database from data/img_D_SFDD_ImgSz_64.pickle...
('Fit pickled set:', 18077, (18077, 64, 64), (18077,))
('Vld pickled set:', 4347, (4347, 64, 64), (4347,))
('Trn pickled set:', 22424, (22424, 64, 64), (22424,))
('New pickled set:', 79726, (79726, 64, 64), (79726,))

First reload the data we generated in 1_notmist.ipynb.

In [7]:
# pickle_file = 'data/notMNIST.pickle'

# with open(pickle_file, 'rb') as f:
#   save = pickle.load(f)
#   glbXFit = save['glbXFit']
#   glbYFit = save['glbYFit']
#   glbXVld = save['glbXVld']
#   glbYVld = save['glbYVld']
#   glbXNew = save['glbXNew']
#   glbYNew = save['glbYNew']
#   del save  # hint to help gc free up memory
#   print('Training set', glbXFit.shape, glbYFit.shape)
#   print('Validation set', glbXVld.shape, glbYVld.shape)
#   print('Test set', glbXNew.shape, glbYNew.shape)

Reformat into a shape that's more adapted to the models we're going to train:

  • data as a flat matrix,
  • labels as float 1-hot encodings.
In [6]:
def lclreformatData(I, X, Y):  
  X = X.reshape((-1, glbImg['size'] * glbImg['size'])).astype(np.float32)
  # Map 0 to [1.0, 0.0, 0.0 ...], 1 to [0.0, 1.0, 0.0 ...]
  Y = (np.arange(glbRspClassN) == Y[:,None]).astype(np.float32)
  return I, X, Y

glbITrn, glbXTrn, glbYTrn = lclreformatData(
    glbObsTrnIdn, glbObsTrnFtr, glbObsTrnRsp)
glbIFit, glbXFit, glbYFit = lclreformatData(
    glbObsFitIdn, glbObsFitFtr, glbObsFitRsp)
glbIVld, glbXVld, glbYVld = lclreformatData(
    glbObsVldIdn, glbObsVldFtr, glbObsVldRsp)
glbINew, glbXNew, glbYNew = lclreformatData(
    glbObsNewIdn, glbObsNewFtr, glbObsNewRsp)

print('Trn reshaped set:', len(glbITrn), glbXTrn.shape, glbYTrn.shape)
print('Fit reshaped set:', len(glbIFit), glbXFit.shape, glbYFit.shape)
print('Vld reshaped set:', len(glbIVld), glbXVld.shape, glbYVld.shape)
print('New reshaped set:', len(glbINew), glbXNew.shape, glbYNew.shape)
('Trn reshaped set:', 22424, (22424, 4096), (22424, 10))
('Fit reshaped set:', 18077, (18077, 4096), (18077, 10))
('Vld reshaped set:', 4347, (4347, 4096), (4347, 10))
('New reshaped set:', 79726, (79726, 4096), (79726, 10))
In [7]:
# Check how much incremental memory is used for Fit obs
# del glbObsFitIdn, glbObsFitFtr, glbObsFitRsp
# del glbIFit, glbXFit, glbYFit

# Check how much incremental memory is used for Trn obs
del glbObsTrnIdn, glbObsTrnFtr, glbObsTrnRsp
del glbITrn, glbXTrn, glbYTrn
In [8]:
# print glbObsFitFtr.shape
print glbObsTrnFtr.shape
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-f345b4057731> in <module>()
      1 # print glbObsFitFtr.shape
----> 2 print glbObsTrnFtr.shape

NameError: name 'glbObsTrnFtr' is not defined

Fit Logistic Regression (TensorFlow)

Let's now switch to stochastic gradient descent training instead, which is much faster. The graph will be similar, except that instead of holding all the training data into a constant node, we create a Placeholder node which will be fed actual data at every call of sesion.run().

In [9]:
%run img_glbSpec_SFDD_ImgSz_64.py
%run img_utils.py

# Add parameter for lrnRateTfw = 0.5 for GradientDescentOptimizer

# With gradient descent training, even this much data is prohibitive.
# Subset the training data for faster turnaround.
def fitMdlLgtRgrSGDTfw(lclXFit, lclYFit, 
            nObsFit = 100, nObsBtc = 16, 
            rotatePby = 0.1, rotateMaxAgl = 5,
            nStepsTfw = 10, lrnRateTfw = 0.1,
                    visualize = False, newObs = False, verbose = False):
    
    from scipy.ndimage import rotate    
    from sklearn import metrics as skl_metrics
    
    prtStr = '\nLogistic Regression (TensorFlow): ' + \
          "nObsFit:%5d; nObsBtc:%5d; " + \
          "rotatePby: %.4f; rotateMaxAgl: %3d; " + \
          "nStepsTfw:%5d; lrnRateTfw:%.4f "
    print(prtStr % ( \
            nObsFit, nObsBtc, \
            rotatePby, rotateMaxAgl, \
            nStepsTfw, lrnRateTfw))
    print("  visualize: %s; newObs: %s; verbose: %s" % ( \
            visualize, newObs, verbose))
    
    startTm = datetime.now()

    mdlDf = pd.DataFrame({'id': 'LgtRgr.SGD.tfw',
                             'nObsFit': [nObsFit],
                             'nObsBtc': [nObsBtc],
                           'rotatePby': [rotatePby],
                        'rotateMaxAgl': [rotateMaxAgl],
                           'nStepsTfw': [nStepsTfw],
                          'lrnRateTfw': [lrnRateTfw]
                         })
    
    graph = tf.Graph()
    with graph.as_default():

      # Input data.
      # The training data, we use a placeholder that will be fed
      #   at run time with a training minibatch.
      # The validation data into constants that 
      #  are attached to the graph.
      # The tests data is loaded by batch thru a placeholder
#       tfwXFit = tf.constant(lclXFit[:nObsFit, :])
#       tfwYFit = tf.constant(lclYFit[:nObsFit])
      tfwXFit = tf.placeholder(tf.float32,
                    shape = (nObsBtc, lclXFit.shape[1]))
      tfwYFit = tf.placeholder(tf.float32, 
                    shape = (nObsBtc, lclYFit.shape[1]))
      tfwXVld = tf.constant(glbXVld)
      tfwYVld = tf.constant(glbYVld)   
      tfwXNew = tf.placeholder(tf.float32, 
                    shape = (glbImg['size'], lclXFit.shape[1]))
      tfwYNew = tf.placeholder(tf.float32, 
                    shape = (glbImg['size'], lclYFit.shape[1]))

      # Variables.
      tf.set_random_seed(glbTfwVarSeed)
    
      # These are the parameters that we are going to be training. 
      # The weight matrix will be initialized using random valued 
      # following a (truncated) normal distribution. 
      # The bias vector get initialized to zero.
      tfwW = tf.Variable(
        tf.truncated_normal([glbImg['size'] * glbImg['size'], 
                             glbRspClassN]), 
        name = 'tfwW')
      tfwB = tf.Variable(tf.zeros([glbRspClassN]), name = 'tfwB')
      if (verbose):  
          print('  tfwW:', tfwW.initialized_value())
          print('  tfwB:', tfwB.initialized_value())
#         print 'lblIx:%2d:%s'% \
#     (np.vectorize("%.4e".__mod__)(tfwW.value()[:5, lblIx]))

      # Training computation.
      # We multiply the inputs with the weight matrix, and add bias. 
      # We compute the softmax and cross-entropy (it's one operation in
      # TensorFlow, because it's very common, and it can be optimized). 
      # We take the average of this cross-entropy across all training 
      # examples: that's our loss.
      logits = tf.matmul(tfwXFit, tfwW) + tfwB
      loss = tf.reduce_mean(
        tf.nn.softmax_cross_entropy_with_logits(logits, tfwYFit))

      # Optimizer.
      # We are going to find the minimum of this loss using 
      #  gradient descent.
      optimizer = (tf.train
                   .GradientDescentOptimizer(tf.to_float(lrnRateTfw))
                   .minimize(loss))

      # Predictions for the training, validation, and test data.
      # These are not part of training, but merely here so that we can
      # report accuracy_score figures as we train.
      tfwYFitPby = tf.nn.softmax(logits)
      tfwYVldPby = tf.nn.softmax(tf.matmul(tfwXVld, tfwW) + tfwB)
      tfwYNewPby = tf.nn.softmax(tf.matmul(tfwXNew, tfwW) + tfwB)
    
    def accuracy_score(predictions, labels):
      return (1.0 * np.sum(np.argmax(predictions, 1) == 
                           np.argmax(labels, 1))
              / predictions.shape[0])

    tf.set_random_seed(glbTfwVarSeed)
    # For image rotation in feed_dict. Separate seed to ensure 
    #   deterministic performance by tf session irrespective of 
    #   rotation randomization
    np.random.seed(glbNPySeed) 
    with tf.Session(graph=graph) as session:
      # This is a one-time operation which ensures the parameters get
      # initialized as we described in the graph: 
      # random tfwW for the matrix, zeros for the tfwB. 
      tf.initialize_all_variables().run()
      if verbose:
          print('  Initialized')
        
      # Create a dummy feed for test data & occlusion visualization
#       btcNewDct = {tfwXNew: glbXNew[:glbImg['size'], :]}
      for step in range(int(nStepsTfw)):
        
        # Pick an offset within the training data, which has been 
        #   randomized.
        # Note: we could use better randomization across epochs.
        offset = (step * nObsBtc) % (nObsFit - nObsBtc)
        # Generate a minibatch (w/ or w/o rotation)
        if (np.random.rand() > rotatePby):
            btcXFit = lclXFit[offset:(offset + nObsBtc), :]
        else:
            rawXFit = np.reshape(lclXFit[offset:(offset + nObsBtc), :],
                            (nObsBtc, glbImg['size'], glbImg['size']))
            rttXFit = np.zeros_like(rawXFit)
            angle = (np.random.rand() - 0.5) * 2 * rotateMaxAgl
            if (verbose): 
                prtStr = '  step %5d(%5d secs): Minibatch rotation:' + \
                         "angle: %.4f"
                print(prtStr % \
                    (step, thsDrn, \
                     angle))            
#             print '  rawXFit.shape: %s' % (str(rawXFit.shape))
            for ix in xrange(rawXFit.shape[0]):                
#                 if (ix % 10 == 0): 
#                     print '    rawXFit[ix, :, :].shape: %s' % \
#                         (str(rawXFit[ix, :, :].shape))                
                rttXFit[ix, :, :] = rotate(rawXFit[ix, :, :], angle, 
                                        mode = 'nearest', reshape = False)
            btcXFit = np.reshape(rttXFit, 
                        (nObsBtc, glbImg['size'] * glbImg['size']))
            
        btcYFit = lclYFit[offset:(offset + nObsBtc), :]
        
        # Prepare a dictionary telling the session where to feed the 
        #   minibatch. The key of the dictionary is the placeholder node
        #   of the graph to be fed, and the value is the numpy array to 
        #   feed to it.
        feed_dict = {tfwXFit: btcXFit, tfwYFit: btcYFit,
                     tfwXNew: glbXNew[:glbImg['size'], :]}        
        
        # Run the computations. 
        # We tell .run() that we want to run the optimizer,
        # and get the loss value and the training predictions returned
        # as numpy arrays.
        _, l, predictions = \
            session.run([optimizer, loss, tfwYFitPby], 
                        feed_dict = feed_dict)
            
        if mydspVerboseTrigger(step):
          thsDrn = (datetime.now() - startTm).seconds  
          if (thsDrn > 100):
              prtStr = '  step %5d(%5d secs): Minibatch ' + \
                        "accuracy: %.4f; logloss: %.4f"  
              print(prtStr % \
                    (step, thsDrn, 
                     accuracy_score(predictions, btcYFit), l))
        
#       accFit = accuracy_score(tfwYFitPby.eval()[:nObsFit, :], 
#                               tfwYFit.eval()   [:nObsFit, :])
#       logLossFit = \
#         skl_metrics.log_loss(tfwYFit.eval()   [:nObsFit, :], 
#                              tfwYFitPby.eval()[:nObsFit, :])
#       if verbose:
#         print '\n  Fit accuracy:%0.4f' % (accFit)
#         print   '  Fit  logLoss:%0.4f' % (logLossFit)        
    #         print metrics.confusion_matrix(glbYFit[0:nObsFit], 
    #                                         lclYFitPdn)        

      # Calling .eval() on tfwObsVldPred is basically like calling run(), 
      # but just to get that one numpy array. 
      # Note that it recomputes all its graph dependencies.

      lclYVldPby = tfwYVldPby.eval()
      lclYVldPdn = np.argmax(lclYVldPby, 1)
      mdlDf['accVld'] = accVld = accuracy_score(lclYVldPby, glbYVld)
      cnfYVld = skl_metrics.confusion_matrix(glbObsVldRsp, lclYVldPdn)
      accYVldCls = cnfYVld.diagonal() * 1.0 / cnfYVld.sum(axis = 1)
      mdlDf['accVldCls'] = None
      mdlDf.set_value(0, 'accVldCls', {'accCls' : accYVldCls})
    
      mdlDf['logLossVld'] = logLossVld = skl_metrics.log_loss(
                                                glbYVld, lclYVldPby)
      logLossVldCls = mygetMetricLogLoss(glbYVld, lclYVldPby, 
                                         returnTyp = 'class')
      mdlDf['logLossVldCls'] = None
      mdlDf.set_value(0, 'logLossVldCls', 
                      {'logLossCls' : logLossVldCls})

      if verbose:
        print '\n  Vld accuracy:%0.4f' % (accVld)
        print accYVldCls
        print cnfYVld
        yLbl = [glbRspClassDesc[glbRspClass[ix]] + ':' + \
                  glbRspClass[ix] + ':actl' \
                for ix in xrange(glbRspClassN)]
        xLbl = ['pred:' + glbRspClass[ix] + ':' + \
                glbRspClassDesc[glbRspClass[ix]] \
                   for ix in xrange(glbRspClassN)]
        # print labels
        plt.matshow(cnfYVld, cmap='Reds', interpolation='none')
        plt.yticks(np.arange(10), yLbl)
        plt.xticks(np.arange(10), xLbl, rotation=90);
        plt.show()

        print '\n  Vld  logLoss:%0.4f' % (logLossVld)
        print logLossVldCls

      if visualize:
        mydisplayImagePredictions(session, tfwW.eval(),
                glbIVld, glbObsVldFtr, glbObsVldRsp, lclYVldPby, 
                glbRspClass, glbRspClassDesc, imgVisualFn = None, 
                            tfwXOcc = tfwXNew, tfwYOccPby = tfwYNewPby)    
            
      if newObs:
          print "  predicting %5d new obs..." % (glbYNew.shape[0])  
          lclYNewPby = np.zeros((glbYNew.shape[0], 
                                 tfwYFitPby.get_shape().as_list()[1]))
          lclYNewPby[:, :] = -1.0
          btcSz = tfwXNew.get_shape().as_list()[0]  
          for obsIx in xrange(0, glbYNew.shape[0], btcSz):
            if mydspVerboseTrigger(obsIx) and \
              (datetime.now() - startTm).seconds > 60:
                print "    @%5d secs: obsIx: %5d" % \
                    ((datetime.now() - startTm).seconds, obsIx)    
            obsEnd = obsIx + btcSz
            if obsEnd > lclYNewPby.shape[0]: 
                obsEnd = lclYNewPby.shape[0]                
            btcYNewPby = session.run(tfwYNewPby, 
                feed_dict = {tfwXNew: glbXNew[obsIx:obsEnd, :] \
                    if obsEnd != lclYNewPby.shape[0] \
                    else np.vstack((glbXNew[obsIx:obsEnd, :], 
                            glbXNew[0:((obsIx + btcSz) % obsEnd), :]))
                                })
            lclYNewPby[obsIx:obsEnd, :] = btcYNewPby[:, :] \
                                if obsEnd != lclYNewPby.shape[0] \
                                else btcYNewPby[:(obsEnd - obsIx), :]    
          
          assert (lclYNewPby[:, :] != -1.0).all(), \
            'some cells in lclYNewPby == -1.0'
#           lclYNewPdn      = tfwYNew.eval()            
#           lclYNewPby = tfwYNewPby.eval()
          lclYNewPdn = np.argmax(lclYNewPby, 1) 
          #if (tfwYNew.eval() > -1).any():
          if (len(np.unique(glbYNew, return_counts = True)[0]) > 1):        
              mdlDf['accNew'] = accNew = accuracy_score(lclYNewPby, 
                                                        glbYNew)
              mdlDf['logLossNew'] = logLossNew = skl_metrics.log_loss(
                                                glbYNew, lclYNewPby)    
              if verbose:      
                print '\n  New accuracy:%0.4f' % (accNew)
                print   '  New  logLoss:%0.4f' % (logLossNew)        
                print skl_metrics.confusion_matrix(glbObsNewRsp, 
                                                   lclYNewPdn)
                yLbl = [glbRspClassDesc[glbRspClass[ix]] + ':' + 
                          glbRspClass[ix] + ':actl' \
                        for ix in xrange(glbRspClassN)]
                xLbl = ['pred:' + glbRspClass[ix] + ':' + \
                        glbRspClassDesc[glbRspClass[ix]] \
                           for ix in xrange(glbRspClassN)]
                # print labels
                plt.matshow(skl_metrics.confusion_matrix(glbObsNewRsp, 
                                                         lclYNewPdn), 
                            cmap='Reds', interpolation='none')
                plt.yticks(np.arange(10), yLbl)
                plt.xticks(np.arange(10), xLbl, rotation=90);
                plt.show()
                
          if visualize:      
              mydisplayImagePredictions(session, tfwW.eval(),
                glbINew, glbObsNewFtr, glbObsNewRsp, lclYNewPby, 
                glbRspClass, glbRspClassDesc, imgVisualFn = None, 
                        tfwXOcc = tfwXNew, tfwYOccPby = tfwYNewPby)    

          mdlDf['predNew'] = None
          mdlDf.set_value(0, 'predNew', {'kntCls' : np.unique(lclYNewPdn, 
                                            return_counts = True)})
          if verbose:
            print '\n  New prediction knts:'
            print mdlDf['predNew'][0]
            
      # indentation (6 spaces) determines scope of this
      #   before session.__exit__ & graph.__exit__        
      mdlDf['model'] = session 
    
    mdlDf['duration'] = (datetime.now() - startTm).seconds  
    print('  duration: %.2d seconds' % (mdlDf['duration'][0]))  
    
    if not newObs: lclYNewPby = None
    return(mdlDf, lclYVldPby, lclYNewPby)

tmpMdlDf = pd.DataFrame()

# thsMdlDf, thsYVldPby, thsYNewPby = fitMdlLgtRgrSGDTfw(
#     glbXFit, glbYFit, 
#     nObsFit = 100, nObsBtc = 16, 
#     rotatePby = 0.2, rotateMaxAgl = 10,
#     nStepsTfw = 10, lrnRateTfw = 0.5,
#     visualize = True, newObs = True, verbose = True)
# tmpMdlDf = tmpMdlDf.append(thsMdlDf)

# To check if model results are deterministic & 
# all run options work separately
thsMdlDf, thsYVldPby, thsYNewPby = fitMdlLgtRgrSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,    
    nStepsTfw = 10, lrnRateTfw = 0.5, 
    visualize = True, newObs = False, verbose = False)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

thsMdlDf, thsYVldPby, thsYNewPby = fitMdlLgtRgrSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,    
    nStepsTfw = 10, lrnRateTfw = 0.5, 
    visualize = False, newObs = True, verbose = False)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

thsMdlDf, thsYVldPby, thsYNewPby = fitMdlLgtRgrSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,    
    nStepsTfw = 10, lrnRateTfw = 0.5, 
    visualize = False, newObs = False, verbose = True)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

thsMdlDf, thsYVldPby, thsYNewPby = fitMdlLgtRgrSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,
    nStepsTfw = 10, lrnRateTfw = 0.5,
    visualize = False, newObs = False, verbose = False)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

print '\ntmpMdlDf: '
print(tmpMdlDf)
imported img_glbSpec_SFDD_Img_Sz_64.py

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: True; newObs: False; verbose: False


max Pby for cls: c0; desc: normal driving; proba: 0.9169; nObs: 1
  img_23350.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.9169  0.      0.      0.      0.083   0.      0.      0.0001  0.      0.    ]
min Pby for cls: c0; desc: normal driving; proba: 0.9169; nObs: 1
  img_23350.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.9169  0.      0.      0.      0.083   0.      0.      0.0001  0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 179
  img_8759.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.4792; nObs: 1
  img_21880.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.4792  0.425   0.      0.      0.      0.0957  0.      0.    ]
  next best class: texting - left


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 440
  img_29251.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.4872; nObs: 1
  img_74128.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.4701  0.4872  0.      0.      0.      0.0427  0.      0.    ]
  next best class: talking on the phone - right


max Pby for cls: c4; desc: talking on the phone - left; proba: 0.9905; nObs: 1
  img_53159.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.0023  0.0072  0.9905  0.      0.      0.      0.      0.    ]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.9905; nObs: 1
  img_53159.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.0023  0.0072  0.9905  0.      0.      0.      0.      0.    ]
  next best class: texting - left


max Pby for cls: c6; desc: drinking; proba: 0.8050; nObs: 1
  img_22902.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.018   0.1439  0.      0.0332  0.      0.805   0.      0.      0.    ]
min Pby for cls: c6; desc: drinking; proba: 0.8050; nObs: 1
  img_22902.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.018   0.1439  0.      0.0332  0.      0.805   0.      0.      0.    ]
  next best class: talking on the phone - right


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 4
  img_91808.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.5289; nObs: 1
  img_35334.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.0049  0.4662  0.      0.      0.      0.5289  0.      0.    ]
  next best class: texting - left
  duration: 26 seconds

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: False; newObs: True; verbose: False
  predicting 79726 new obs...
  duration: 13 seconds

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: False; newObs: False; verbose: True
('  tfwW:', <tf.Tensor 'Identity:0' shape=(4096, 10) dtype=float32>)
('  tfwB:', <tf.Tensor 'Identity_1:0' shape=(10,) dtype=float32>)
  Initialized
  step     1(    0 secs): Minibatch rotation:angle: 3.9074
  step     6(    0 secs): Minibatch rotation:angle: 6.9499

  Vld accuracy:0.1049
[ 0.      0.      0.5111  0.5056  0.      0.      0.      0.0029  0.      0.    ]
[[  0   0 308 174   0   0   0   2   0   0]
 [  0   0 158 320   0   0   0   0   0   0]
 [  0   0 231 220   0   0   0   1   0   0]
 [  0   0 219 224   0   0   0   0   0   0]
 [  0   0 149 308   0   0   0   2   0   0]
 [  1   0  76 304   0   0   0  41   0   0]
 [  0   0 135 307   0   0   0   1   0   0]
 [  0   0 151 197   1   0   0   1   0   0]
 [  0   0 199 165   0   0   0   0   0   0]
 [  0   0 262 183   0   0   1   6   0   0]]
  Vld  logLoss:26.7370
[ 3.8456  3.6906  0.3847  0.3825  3.5034  3.353   3.5066  1.5953  2.8921
  3.5831]
  duration: 01 seconds

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: False; newObs: False; verbose: False
  duration: 00 seconds

tmpMdlDf: 
   accVld                                          accVldCls  duration  \
0  0.1049  {u'accCls': [0.0, 0.0, 0.511061946903, 0.50564...        26   
0  0.1049  {u'accCls': [0.0, 0.0, 0.511061946903, 0.50564...        13   
0  0.1049  {u'accCls': [0.0, 0.0, 0.511061946903, 0.50564...         1   
0  0.1049  {u'accCls': [0.0, 0.0, 0.511061946903, 0.50564...         0   

               id  logLossVld  \
0  LgtRgr.SGD.tfw   26.737001   
0  LgtRgr.SGD.tfw   26.737001   
0  LgtRgr.SGD.tfw   26.737001   
0  LgtRgr.SGD.tfw   26.737001   

                                       logLossVldCls  lrnRateTfw  \
0  {u'logLossCls': [3.84558724986, 3.69061398653,...         0.5   
0  {u'logLossCls': [3.84558724986, 3.69061398653,...         0.5   
0  {u'logLossCls': [3.84558724986, 3.69061398653,...         0.5   
0  {u'logLossCls': [3.84558724986, 3.69061398653,...         0.5   

                                               model  nObsBtc  nObsFit  \
0  <tensorflow.python.client.session.Session obje...       16      100   
0  <tensorflow.python.client.session.Session obje...       16      100   
0  <tensorflow.python.client.session.Session obje...       16      100   
0  <tensorflow.python.client.session.Session obje...       16      100   

   nStepsTfw                                            predNew  rotateMaxAgl  \
0         10                                                NaN            10   
0         10  {u'kntCls': ([1, 2, 3, 4, 6, 7, 8, 9], [157, 5...            10   
0         10                                                NaN            10   
0         10                                                NaN            10   

   rotatePby  
0        0.2  
0        0.2  
0        0.2  
0        0.2  
In [30]:
lr1MdlDf, lr1YVldPby, lr1YNewPby = fitMdlLgtRgrTfw(
    glbXFit, glbYFit, 
    nObsFit = 1000, nStepsTfw = 100, lrnRateTfw = 0.1, 
    visualize = False, newObs = True, verbose = True)
Logistic Regression (TensorFlow): nObsFit: 1000; nStepsTfw:  100; lrnRateTfw:0.1000
  visualize: False; newObs: True; verbose: True
('  tfwW:', <tf.Tensor 'Identity:0' shape=(4096, 10) dtype=float32>)
('  tfwB:', <tf.Tensor 'Identity_1:0' shape=(10,) dtype=float32>)
  Initialized

  Fit accuracy:0.2470
  Fit  logLoss:7.2014

  Vld accuracy:0.1735
  Vld  logLoss:12.6001
[[ 73  22  44  15  77   7  94  50  18  84]
 [ 33  68  51  31  24  22  90  77  10  72]
 [ 14 100  61   9 115   1  28 113   2   9]
 [  2  18  29 136  34   7  37  19  10 151]
 [  5  14  17 137  67   9  58  91   3  58]
 [ 11  16  19  41 114  13  14 151  30  13]
 [  9  47  31  55 113   9  45  96  19  19]
 [  1  16  10  14  57  28  45 130  24  25]
 [ 21  12  47  36  47  16  50  66   8  61]
 [  2  12  15   8  38   9  56 140  19 153]]
  predicting 79726 new obs...

  New prediction knts:
{'clsKnt': (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([ 8786, 11144, 10374,  6453,  5874,  4904,  9130,  6548,  7613,  8900]))}
  duration: 19 seconds
In [31]:
lr5MdlDf, lr5YVldPby, lr5YNewPby = fitMdlLgtRgrTfw(
    glbXFit, glbYFit, 
    nObsFit = 1000, nStepsTfw = 100, lrnRateTfw = 0.5, 
    visualize = False, newObs = True, verbose = True)
Logistic Regression (TensorFlow): nObsFit: 1000; nStepsTfw:  100; lrnRateTfw:0.5000
  visualize: False; newObs: True; verbose: True
('  tfwW:', <tf.Tensor 'Identity:0' shape=(4096, 10) dtype=float32>)
('  tfwB:', <tf.Tensor 'Identity_1:0' shape=(10,) dtype=float32>)
  Initialized

  Fit accuracy:0.4970
  Fit  logLoss:5.6870

  Vld accuracy:0.2227
  Vld  logLoss:13.3804
[[148  76  77   0  65   0   4  41   4  69]
 [ 58  87 100   0  44   4   2 121   9  53]
 [ 11  63 120   0 110   0   0 121   0  27]
 [ 10  36  83   1 132   3   3  31   0 144]
 [ 11  19  86   0 197   5  17  53   0  71]
 [ 34   7  66   0  79  35   1 121  38  41]
 [ 33  35 135   0 134   2   1  73   5  25]
 [  2  15  39   0  46  10   0 191  22  25]
 [ 30  24 105   0  40   6   0  62  32  65]
 [ 13  12  87   0  47   6   0 128   3 156]]
  predicting 79726 new obs...

  New prediction knts:
{'clsKnt': (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([12150, 13070, 22283,   135,  4653,  4845,   390,  7545,  5352,  9303]))}
  duration: 19 seconds
In [108]:
%run img_utils.py
from sklearn import metrics as skl_metrics    

def lclaccuracy_score(predictions, labels):
      return (1.0 * np.sum(np.argmax(predictions, 1) == 
                           np.argmax(labels, 1))
              / predictions.shape[0])
    
print "\nlrnRateTfw: 0.1; accVld: %0.4f" % \
    (lclaccuracy_score(lr1YVldPby, glbYVld))
cnf1YVld = skl_metrics.confusion_matrix(glbObsVldRsp, 
                                        np.argmax(lr1YVldPby, 1))
print cnf1YVld
# print cnf1YVld.sum(axis = 1)
print cnf1YVld.diagonal() * 1.0 / cnf1YVld.sum(axis = 1)
# print cnf1YVld.sum(axis = 1).sum()

lls1YVld = skl_metrics.log_loss(glbYVld, lr1YVldPby)
print "\nlrnRateTfw: 0.1; logLossVld: %0.4f" % (lls1YVld)
# lls1YVldCls = np.array([skl_metrics.log_loss(
#                glbYVld[glbYVld[:, clsIx] == 1, :], 
#             lr1YVldPby[glbYVld[:, clsIx] == 1, :]) \
#                      for clsIx in range(glbRspClassN)]) / glbRspClassN
# print "lrnRateTfw: 0.1; logLossVld.skl classSum: %0.4f" % (lls1YVld.sum())
# print lls1YVld
lls1YVldCls = mygetMetricLogLoss(glbYVld, lr1YVldPby, returnTyp = 'class')
print "lrnRateTfw: 0.1; logLossVldCls :"; print lls1YVldCls
# print "diff: %.4e" % (np.abs(lls1YVld - lls1YVldCls.sum()))
assert np.abs(lls1YVld - lls1YVldCls.sum()) < 1e-04, \
    "logLoss from skl: %.4f vs myCls %.4f does not match" % \
    (lls1YVld, lls1YVldCls.sum())
    
print "\nlrnRateTfw: 0.5; accVld: %0.4f" % \
    (lclaccuracy_score(lr5YVldPby, glbYVld))
cnf5YVld = skl_metrics.confusion_matrix(glbObsVldRsp, 
                                        np.argmax(lr5YVldPby, 1))
print cnf5YVld
print cnf5YVld.diagonal() * 1.0 / cnf5YVld.sum(axis = 1)

lls5YVld = skl_metrics.log_loss(glbYVld, lr5YVldPby)
print "\nlrnRateTfw: 0.5; logLossVld: %0.4f" % (lls5YVld)
lls5YVldCls = mygetMetricLogLoss(glbYVld, lr5YVldPby, returnTyp = 'class')
print "lrnRateTfw: 0.5; logLossVldCls :"; print lls5YVldCls
assert np.abs(lls5YVld - lls5YVldCls.sum()) < 1e-04, \
    "logLoss from skl: %.4f vs myCls %.4f does not match" % \
    (lls5YVld, lls5YVldCls.sum())
lrnRateTfw: 0.1; accVld: 0.1735
[[ 73  22  44  15  77   7  94  50  18  84]
 [ 33  68  51  31  24  22  90  77  10  72]
 [ 14 100  61   9 115   1  28 113   2   9]
 [  2  18  29 136  34   7  37  19  10 151]
 [  5  14  17 137  67   9  58  91   3  58]
 [ 11  16  19  41 114  13  14 151  30  13]
 [  9  47  31  55 113   9  45  96  19  19]
 [  1  16  10  14  57  28  45 130  24  25]
 [ 21  12  47  36  47  16  50  66   8  61]
 [  2  12  15   8  38   9  56 140  19 153]]
[ 0.1508  0.1423  0.135   0.307   0.146   0.0308  0.1016  0.3714  0.022
  0.3385]

lrnRateTfw: 0.1; logLossVld: 12.6001
lrnRateTfw: 0.1; logLossVldCls :
[ 1.4741  2.0839  1.4873  0.8025  1.0307  1.8989  1.0157  0.5303  1.2532
  1.0236]

lrnRateTfw: 0.5; accVld: 0.2227
[[148  76  77   0  65   0   4  41   4  69]
 [ 58  87 100   0  44   4   2 121   9  53]
 [ 11  63 120   0 110   0   0 121   0  27]
 [ 10  36  83   1 132   3   3  31   0 144]
 [ 11  19  86   0 197   5  17  53   0  71]
 [ 34   7  66   0  79  35   1 121  38  41]
 [ 33  35 135   0 134   2   1  73   5  25]
 [  2  15  39   0  46  10   0 191  22  25]
 [ 30  24 105   0  40   6   0  62  32  65]
 [ 13  12  87   0  47   6   0 128   3 156]]
[ 0.3058  0.182   0.2655  0.0023  0.4292  0.0829  0.0023  0.5457  0.0879
  0.3451]

lrnRateTfw: 0.5; logLossVld: 13.3804
lrnRateTfw: 0.5; logLossVldCls :
[ 1.0024  1.5107  0.8492  2.5585  0.8238  1.6644  2.5152  0.3775  1.327
  0.7518]
In [10]:
# glbMdlDf = None
# glbMdlDf = pd.DataFrame()

try:
    with open(glbPickleFile['models'], 'rb') as f:
        glbMdlDf = pickle.load(f)
        assert isinstance(glbMdlDf, pd.DataFrame), \
            'type(glbMdlDf): %s, expecting pd.DataFrame' % \
            (str(type(glbMdlDf)))            
except IOError, e:
    print e
    print 'file %s not present or not appropriate' % \
        (glbPickleFile['models'])        
print glbMdlDf
                                                                              accVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             1.000000   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             0.987348   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             0.375201   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             0.361859   
                                                    2.0       1             0.357488   
                                 0.0       8.0      3.0       0             0.357028   
                                                              2             0.357028   
                                                              1             0.357028   
                                                              10            0.357028   
                                 0.1       8.0      3.0       0             0.357028   
                                           4.0      1.0       1             0.355648   
                                           8.0      2.0       2             0.351737   
                                                              4             0.348516   
                                           16.0     4.0       10            0.346216   
                                 0.0       8.0      7.0       10            0.346216   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             0.343685   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            0.338854   
                                                              1             0.338854   
                                           8.0      5.0       10            0.336784   
                                 0.5       8.0      4.0       10            0.334484   
                                           16.0     4.0       10            0.331723   
                                 0.0       8.0      1.0       0             0.331493   
                                                              1             0.331493   
                                                              2             0.331493   
                                                              10            0.331493   
                                 0.1       8.0      1.0       0             0.331493   
                                 0.0       32.0     1.0       10            0.328042   
                                 0.1       8.0      2.0       5             0.325512   
                                 0.0       8.0      0.5       10            0.325052   
...                                                                              ...   
                                 0.1       4.0      3.0       1             0.226823   
                                           16.0     3.0       10            0.219692   
                                 0.0       16.0     2.0       2             0.214861   
                                                              10            0.214861   
                                                              1             0.214861   
                                                              0             0.214861   
                100.0    18077.0 0.1       16.0     1.0       10            0.210950   
                1000.0   18077.0 0.5       4.0      3.0       10            0.208420   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             0.342535   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             0.384173   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             0.358638   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             0.319991   
                                                    0.1       0             0.251208   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            0.210950   
                1000.0   9000.0  0.1       8.0      3.0       2             0.381643   
                         8000.0  0.1       8.0      3.0       2             0.378882   
                         7000.0  0.1       8.0      3.0       2             0.375431   
                         6000.0  0.1       8.0      3.0       2             0.339545   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             0.363699   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             0.320911   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0             0.341385   
                         1000.0  0.0       1000.0  -1.0       0             0.333333   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             0.273522   
                                                    1.0       0             0.255809   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             0.224983   
                100.0    1000.0  0.1       16.0     1.0       10            0.212790   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             0.173453   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             0.307108   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             0.224753   

                                                                                                                    accVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'accCls': [0.504132231405, 0.435146443515, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             {u'accCls': [0.448347107438, 0.44769874477, 0....   
                                                    2.0       1             {u'accCls': [0.338842975207, 0.347280334728, 0...   
                                 0.0       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              2             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              1             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              10            {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                 0.1       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                           4.0      1.0       1             {u'accCls': [0.52479338843, 0.575313807531, 0....   
                                           8.0      2.0       2             {u'accCls': [0.146694214876, 0.5, 0.2123893805...   
                                                              4             {u'accCls': [0.384297520661, 0.297071129707, 0...   
                                           16.0     4.0       10            {u'accCls': [0.510330578512, 0.389121338912, 0...   
                                 0.0       8.0      7.0       10            {u'accCls': [0.421487603306, 0.410041841004, 0...   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                                              1             {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                           8.0      5.0       10            {u'accCls': [0.338842975207, 0.173640167364, 0...   
                                 0.5       8.0      4.0       10            {u'accCls': [0.421487603306, 0.558577405858, 0...   
                                           16.0     4.0       10            {u'accCls': [0.396694214876, 0.0836820083682, ...   
                                 0.0       8.0      1.0       0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              1             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              2             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              10            {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                 0.1       8.0      1.0       0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                 0.0       32.0     1.0       10            {u'accCls': [0.588842975207, 0.133891213389, 0...   
                                 0.1       8.0      2.0       5             {u'accCls': [0.276859504132, 0.219665271967, 0...   
                                 0.0       8.0      0.5       10            {u'accCls': [0.365702479339, 0.119246861925, 0...   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1             {u'accCls': [0.545454545455, 0.0690376569038, ...   
                                           16.0     3.0       10            {u'accCls': [0.528925619835, 0.0523012552301, ...   
                                 0.0       16.0     2.0       2             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              10            {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              1             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              0             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   18077.0 0.5       4.0      3.0       10            {u'accCls': [0.297520661157, 0.081589958159, 0...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'accCls': [0.456611570248, 0.380753138075, 0...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             {u'accCls': [0.289256198347, 0.182008368201, 0...   
                                                    0.1       0             {u'accCls': [0.169421487603, 0.144351464435, 0...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   9000.0  0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
                         8000.0  0.1       8.0      3.0       2             {u'accCls': [0.553719008264, 0.610878661088, 0...   
                         7000.0  0.1       8.0      3.0       2             {u'accCls': [0.431818181818, 0.558577405858, 0...   
                         6000.0  0.1       8.0      3.0       2             {u'accCls': [0.181818181818, 0.671548117155, 0...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             {u'accCls': [0.543388429752, 0.535564853556, 0...   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN   
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             {u'accCls': [0.646694214876, 0.0564853556485, ...   
                                                    1.0       0             {u'accCls': [0.423553719008, 0.182008368201, 0...   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             {u'accCls': [0.204545454545, 0.0334728033473, ...   
                100.0    1000.0  0.1       16.0     1.0       10            {u'accCls': [0.136363636364, 0.0230125523013, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'accCls': [0.150826446281, 0.142259414226, 0...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'accCls': [0.0185950413223, 0.133891213389, ...   

                                                                           bestFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0              False   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2               True   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2              False   
                                                    2.0       1              False   
                                 0.0       8.0      3.0       0              False   
                                                              2              False   
                                                              1              False   
                                                              10             False   
                                 0.1       8.0      3.0       0              False   
                                           4.0      1.0       1              False   
                                           8.0      2.0       2              False   
                                                              4              False   
                                           16.0     4.0       10             False   
                                 0.0       8.0      7.0       10             False   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10             False   
                                                              1              False   
                                           8.0      5.0       10             False   
                                 0.5       8.0      4.0       10             False   
                                           16.0     4.0       10             False   
                                 0.0       8.0      1.0       0              False   
                                                              1              False   
                                                              2              False   
                                                              10             False   
                                 0.1       8.0      1.0       0              False   
                                 0.0       32.0     1.0       10             False   
                                 0.1       8.0      2.0       5              False   
                                 0.0       8.0      0.5       10             False   
...                                                                            ...   
                                 0.1       4.0      3.0       1              False   
                                           16.0     3.0       10             False   
                                 0.0       16.0     2.0       2              False   
                                                              10             False   
                                                              1              False   
                                                              0              False   
                100.0    18077.0 0.1       16.0     1.0       10             False   
                1000.0   18077.0 0.5       4.0      3.0       10             False   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0              False   
                                                    0.1       0              False   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             False   
                1000.0   9000.0  0.1       8.0      3.0       2                NaN   
                         8000.0  0.1       8.0      3.0       2                NaN   
                         7000.0  0.1       8.0      3.0       2                NaN   
                         6000.0  0.1       8.0      3.0       2                NaN   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0              False   
                         1000.0  0.0       1000.0  -1.0       0              False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              False   
                                                    1.0       0              False   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              False   
                100.0    1000.0  0.1       16.0     1.0       10             False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              False   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              False   

                                                                            duration  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                  874   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                  743   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                   11   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                  519   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                    9   
                                                    2.0       1                   10   
                                 0.0       8.0      3.0       0                    8   
                                                              2                    8   
                                                              1                    9   
                                                              10                  10   
                                 0.1       8.0      3.0       0                   10   
                                           4.0      1.0       1                    8   
                                           8.0      2.0       2                   10   
                                                              4                   13   
                                           16.0     4.0       10                  14   
                                 0.0       8.0      7.0       10                   9   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                  597   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                   8   
                                                              1                    8   
                                           8.0      5.0       10                   9   
                                 0.5       8.0      4.0       10                  15   
                                           16.0     4.0       10                  24   
                                 0.0       8.0      1.0       0                    8   
                                                              1                    8   
                                                              2                    8   
                                                              10                   9   
                                 0.1       8.0      1.0       0                   13   
                                 0.0       32.0     1.0       10                  16   
                                 0.1       8.0      2.0       5                   10   
                                 0.0       8.0      0.5       10                   9   
...                                                                              ...   
                                 0.1       4.0      3.0       1                    9   
                                           16.0     3.0       10                  13   
                                 0.0       16.0     2.0       2                   10   
                                                              10                  11   
                                                              1                   11   
                                                              0                   11   
                100.0    18077.0 0.1       16.0     1.0       10                   2   
                1000.0   18077.0 0.5       4.0      3.0       10                  12   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                  514   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                  288   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                  317   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                  301   
                                                    0.1       0                  295   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                   2   
                1000.0   9000.0  0.1       8.0      3.0       2                    9   
                         8000.0  0.1       8.0      3.0       2                    9   
                         7000.0  0.1       8.0      3.0       2                    9   
                         6000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                  150   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                   55   
                         1000.0  0.0       1000.0  -1.0       0                   28   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                    7   
                                                    1.0       0                    5   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                    9   
                100.0    1000.0  0.1       16.0     1.0       10                   2   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                    5   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                    8   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                    9   

                                                                                        id  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             LgtRgr.SGD.tfw   
                                                    2.0       1             LgtRgr.SGD.tfw   
                                 0.0       8.0      3.0       0             LgtRgr.SGD.tfw   
                                                              2             LgtRgr.SGD.tfw   
                                                              1             LgtRgr.SGD.tfw   
                                                              10            LgtRgr.SGD.tfw   
                                 0.1       8.0      3.0       0             LgtRgr.SGD.tfw   
                                           4.0      1.0       1             LgtRgr.SGD.tfw   
                                           8.0      2.0       2             LgtRgr.SGD.tfw   
                                                              4             LgtRgr.SGD.tfw   
                                           16.0     4.0       10            LgtRgr.SGD.tfw   
                                 0.0       8.0      7.0       10            LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                 LgtRgr.skl   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            LgtRgr.SGD.tfw   
                                                              1             LgtRgr.SGD.tfw   
                                           8.0      5.0       10            LgtRgr.SGD.tfw   
                                 0.5       8.0      4.0       10            LgtRgr.SGD.tfw   
                                           16.0     4.0       10            LgtRgr.SGD.tfw   
                                 0.0       8.0      1.0       0             LgtRgr.SGD.tfw   
                                                              1             LgtRgr.SGD.tfw   
                                                              2             LgtRgr.SGD.tfw   
                                                              10            LgtRgr.SGD.tfw   
                                 0.1       8.0      1.0       0             LgtRgr.SGD.tfw   
                                 0.0       32.0     1.0       10            LgtRgr.SGD.tfw   
                                 0.1       8.0      2.0       5             LgtRgr.SGD.tfw   
                                 0.0       8.0      0.5       10            LgtRgr.SGD.tfw   
...                                                                                    ...   
                                 0.1       4.0      3.0       1             LgtRgr.SGD.tfw   
                                           16.0     3.0       10            LgtRgr.SGD.tfw   
                                 0.0       16.0     2.0       2             LgtRgr.SGD.tfw   
                                                              10            LgtRgr.SGD.tfw   
                                                              1             LgtRgr.SGD.tfw   
                                                              0             LgtRgr.SGD.tfw   
                100.0    18077.0 0.1       16.0     1.0       10            LgtRgr.SGD.tfw   
                1000.0   18077.0 0.5       4.0      3.0       10            LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                 LgtRgr.tfw   
                                                    0.1       0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            LgtRgr.SGD.tfw   
                1000.0   9000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
                         8000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
                         7000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
                         6000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                 LgtRgr.skl   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                 LgtRgr.skl   
                         1000.0  0.0       1000.0  -1.0       0                 LgtRgr.skl   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                 LgtRgr.tfw   
                                                    1.0       0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
                100.0    1000.0  0.1       16.0     1.0       10            LgtRgr.SGD.tfw   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                 LgtRgr.tfw   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                 LgtRgr.skl   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             LgtRgr.SGD.tfw   

                                                                            logLossVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0               0.018463   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0               0.193149   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              19.209913   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2              17.898932   
                                                    2.0       1              20.091985   
                                 0.0       8.0      3.0       0              20.948740   
                                                              2              20.948740   
                                                              1              20.948740   
                                                              10             20.948740   
                                 0.1       8.0      3.0       0              20.948740   
                                           4.0      1.0       1              19.602959   
                                           8.0      2.0       2              19.997834   
                                                              4              20.635511   
                                           16.0     4.0       10             21.347350   
                                 0.0       8.0      7.0       10             21.886713   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0               3.116799   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10             22.423282   
                                                              1              22.423282   
                                           8.0      5.0       10             22.167039   
                                 0.5       8.0      4.0       10             22.007029   
                                           16.0     4.0       10             21.561740   
                                 0.0       8.0      1.0       0              19.594075   
                                                              1              19.594075   
                                                              2              19.594075   
                                                              10             19.594075   
                                 0.1       8.0      1.0       0              19.594075   
                                 0.0       32.0     1.0       10             16.835064   
                                 0.1       8.0      2.0       5              21.457194   
                                 0.0       8.0      0.5       10             16.048818   
...                                                                                ...   
                                 0.1       4.0      3.0       1              26.212732   
                                           16.0     3.0       10             25.966046   
                                 0.0       16.0     2.0       2              25.605293   
                                                              10             25.605293   
                                                              1              25.605293   
                                                              0              25.605293   
                100.0    18077.0 0.1       16.0     1.0       10             24.085776   
                1000.0   18077.0 0.5       4.0      3.0       10             26.843734   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0               3.085191   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              18.995890   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0               2.885114   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0               9.502959   
                                                    0.1       0               8.912652   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             24.085776   
                1000.0   9000.0  0.1       8.0      3.0       2              20.546733   
                         8000.0  0.1       8.0      3.0       2              20.345963   
                         7000.0  0.1       8.0      3.0       2              20.307083   
                         6000.0  0.1       8.0      3.0       2              21.354761   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0               2.610439   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              21.899301   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0               2.498749   
                         1000.0  0.0       1000.0  -1.0       0               2.539650   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              24.274683   
                                                    1.0       0              14.714048   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              25.728109   
                100.0    1000.0  0.1       16.0     1.0       10             18.141110   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              12.600104   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0               2.497940   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              25.837055   

                                                                                                                logLossVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'logLossCls': [1.72596805748, 1.7853875361, ...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             {u'logLossCls': [1.7477126908, 1.45845704706, ...   
                                                    2.0       1             {u'logLossCls': [2.4098162987, 2.1249522721, 2...   
                                 0.0       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              2             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              1             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              10            {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                 0.1       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                           4.0      1.0       1             {u'logLossCls': [1.47759900586, 1.5216033003, ...   
                                           8.0      2.0       2             {u'logLossCls': [2.96027056113, 1.55809628297,...   
                                                              4             {u'logLossCls': [2.1684078246, 2.40346788464, ...   
                                           16.0     4.0       10            {u'logLossCls': [1.79621628564, 1.99717570497,...   
                                 0.0       8.0      7.0       10            {u'logLossCls': [2.16842694926, 2.08737047825,...   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                                              1             {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                           8.0      5.0       10            {u'logLossCls': [2.49658612049, 3.01094383144,...   
                                 0.5       8.0      4.0       10            {u'logLossCls': [2.1293109356, 1.52307431523, ...   
                                           16.0     4.0       10            {u'logLossCls': [2.13819531033, 3.35150390363,...   
                                 0.0       8.0      1.0       0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              1             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              2             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              10            {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                 0.1       8.0      1.0       0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                 0.0       32.0     1.0       10            {u'logLossCls': [1.3367673536, 2.19949472069, ...   
                                 0.1       8.0      2.0       5             {u'logLossCls': [2.47060812006, 2.55482495458,...   
                                 0.0       8.0      0.5       10            {u'logLossCls': [1.73155548863, 2.32786043541,...   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1             {u'logLossCls': [1.71708309944, 3.4968377777, ...   
                                           16.0     3.0       10            {u'logLossCls': [1.71310413171, 3.4687167196, ...   
                                 0.0       16.0     2.0       2             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              10            {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              1             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              0             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   18077.0 0.5       4.0      3.0       10            {u'logLossCls': [2.62356084168, 3.42588099594,...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'logLossCls': [1.84540699409, 1.93896956479,...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             {u'logLossCls': [1.14059053163, 1.46723165909,...   
                                                    0.1       0             {u'logLossCls': [1.11536194976, 1.25718941188,...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   9000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
                         8000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.5257602538, 1.31972597838, ...   
                         7000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.06754908637, 1.51088086827,...   
                         6000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.97387028973, 1.20522205183,...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.57533202071, 1.59023941247,...   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN   
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             {u'logLossCls': [1.28781316316, 3.51519487621,...   
                                                    1.0       0             {u'logLossCls': [0.842354858019, 1.17531354279...   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.84808429073, 3.58756550329,...   
                100.0    1000.0  0.1       16.0     1.0       10            {u'logLossCls': [2.1826821181, 3.34540505739, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'logLossCls': [1.47411393905, 2.08387227918,...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'logLossCls': [3.67759601248, 3.22267129616,...   

                                                                            lrnRateTfw  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                   -1.0   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                   10.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                    3.0   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                   10.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                    1.0   
                                                    2.0       1                    2.0   
                                 0.0       8.0      3.0       0                    3.0   
                                                              2                    3.0   
                                                              1                    3.0   
                                                              10                   3.0   
                                 0.1       8.0      3.0       0                    3.0   
                                           4.0      1.0       1                    1.0   
                                           8.0      2.0       2                    2.0   
                                                              4                    2.0   
                                           16.0     4.0       10                   4.0   
                                 0.0       8.0      7.0       10                   7.0   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                   -1.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                   4.0   
                                                              1                    4.0   
                                           8.0      5.0       10                   5.0   
                                 0.5       8.0      4.0       10                   4.0   
                                           16.0     4.0       10                   4.0   
                                 0.0       8.0      1.0       0                    1.0   
                                                              1                    1.0   
                                                              2                    1.0   
                                                              10                   1.0   
                                 0.1       8.0      1.0       0                    1.0   
                                 0.0       32.0     1.0       10                   1.0   
                                 0.1       8.0      2.0       5                    2.0   
                                 0.0       8.0      0.5       10                   0.5   
...                                                                                ...   
                                 0.1       4.0      3.0       1                    3.0   
                                           16.0     3.0       10                   3.0   
                                 0.0       16.0     2.0       2                    2.0   
                                                              10                   2.0   
                                                              1                    2.0   
                                                              0                    2.0   
                100.0    18077.0 0.1       16.0     1.0       10                   1.0   
                1000.0   18077.0 0.5       4.0      3.0       10                   3.0   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                   -1.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                   10.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                    3.0   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                   -1.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                    1.0   
                                                    0.1       0                    0.1   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                   1.0   
                1000.0   9000.0  0.1       8.0      3.0       2                    3.0   
                         8000.0  0.1       8.0      3.0       2                    3.0   
                         7000.0  0.1       8.0      3.0       2                    3.0   
                         6000.0  0.1       8.0      3.0       2                    3.0   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                   -1.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                    3.0   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                   -1.0   
                         1000.0  0.0       1000.0  -1.0       0                   -1.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                   10.0   
                                                    1.0       0                    1.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                    3.0   
                100.0    1000.0  0.1       16.0     1.0       10                   1.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                    0.1   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                   -1.0   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                    3.0   

                                                                            nObsBtc  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             22424.0   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             22424.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                 8.0   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                 8.0   
                                                    2.0       1                 8.0   
                                 0.0       8.0      3.0       0                 8.0   
                                                              2                 8.0   
                                                              1                 8.0   
                                                              10                8.0   
                                 0.1       8.0      3.0       0                 8.0   
                                           4.0      1.0       1                 4.0   
                                           8.0      2.0       2                 8.0   
                                                              4                 8.0   
                                           16.0     4.0       10               16.0   
                                 0.0       8.0      7.0       10                8.0   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                4.0   
                                                              1                 4.0   
                                           8.0      5.0       10                8.0   
                                 0.5       8.0      4.0       10                8.0   
                                           16.0     4.0       10               16.0   
                                 0.0       8.0      1.0       0                 8.0   
                                                              1                 8.0   
                                                              2                 8.0   
                                                              10                8.0   
                                 0.1       8.0      1.0       0                 8.0   
                                 0.0       32.0     1.0       10               32.0   
                                 0.1       8.0      2.0       5                 8.0   
                                 0.0       8.0      0.5       10                8.0   
...                                                                             ...   
                                 0.1       4.0      3.0       1                 4.0   
                                           16.0     3.0       10               16.0   
                                 0.0       16.0     2.0       2                16.0   
                                                              10               16.0   
                                                              1                16.0   
                                                              0                16.0   
                100.0    18077.0 0.1       16.0     1.0       10               16.0   
                1000.0   18077.0 0.5       4.0      3.0       10                4.0   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             15000.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             10000.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                 8.0   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             10000.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             10000.0   
                                                    0.1       0             10000.0   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10               16.0   
                1000.0   9000.0  0.1       8.0      3.0       2                 8.0   
                         8000.0  0.1       8.0      3.0       2                 8.0   
                         7000.0  0.1       8.0      3.0       2                 8.0   
                         6000.0  0.1       8.0      3.0       2                 8.0   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0              5000.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                 8.0   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0              2000.0   
                         1000.0  0.0       1000.0  -1.0       0              1000.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              1000.0   
                                                    1.0       0              1000.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                 8.0   
                100.0    1000.0  0.1       16.0     1.0       10               16.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              1000.0   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0               100.0   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                 8.0   

                                                                            nObsFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             22424.0   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             22424.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             18077.0   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             18077.0   
                                                    2.0       1             18077.0   
                                 0.0       8.0      3.0       0             18077.0   
                                                              2             18077.0   
                                                              1             18077.0   
                                                              10            18077.0   
                                 0.1       8.0      3.0       0             18077.0   
                                           4.0      1.0       1             18077.0   
                                           8.0      2.0       2             18077.0   
                                                              4             18077.0   
                                           16.0     4.0       10            18077.0   
                                 0.0       8.0      7.0       10            18077.0   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            18077.0   
                                                              1             18077.0   
                                           8.0      5.0       10            18077.0   
                                 0.5       8.0      4.0       10            18077.0   
                                           16.0     4.0       10            18077.0   
                                 0.0       8.0      1.0       0             18077.0   
                                                              1             18077.0   
                                                              2             18077.0   
                                                              10            18077.0   
                                 0.1       8.0      1.0       0             18077.0   
                                 0.0       32.0     1.0       10            18077.0   
                                 0.1       8.0      2.0       5             18077.0   
                                 0.0       8.0      0.5       10            18077.0   
...                                                                             ...   
                                 0.1       4.0      3.0       1             18077.0   
                                           16.0     3.0       10            18077.0   
                                 0.0       16.0     2.0       2             18077.0   
                                                              10            18077.0   
                                                              1             18077.0   
                                                              0             18077.0   
                100.0    18077.0 0.1       16.0     1.0       10            18077.0   
                1000.0   18077.0 0.5       4.0      3.0       10            18077.0   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             15000.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             10000.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             10000.0   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             10000.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             10000.0   
                                                    0.1       0             10000.0   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            10000.0   
                1000.0   9000.0  0.1       8.0      3.0       2              9000.0   
                         8000.0  0.1       8.0      3.0       2              8000.0   
                         7000.0  0.1       8.0      3.0       2              7000.0   
                         6000.0  0.1       8.0      3.0       2              6000.0   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0              5000.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              5000.0   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0              2000.0   
                         1000.0  0.0       1000.0  -1.0       0              1000.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              1000.0   
                                                    1.0       0              1000.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              1000.0   
                100.0    1000.0  0.1       16.0     1.0       10             1000.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              1000.0   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0               100.0   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2               100.0   

                                                                            nStepsTfw  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl              
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                  -1.0   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                1000.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                1000.0   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                1000.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                1000.0   
                                                    2.0       1                1000.0   
                                 0.0       8.0      3.0       0                1000.0   
                                                              2                1000.0   
                                                              1                1000.0   
                                                              10               1000.0   
                                 0.1       8.0      3.0       0                1000.0   
                                           4.0      1.0       1                1000.0   
                                           8.0      2.0       2                1000.0   
                                                              4                1000.0   
                                           16.0     4.0       10               1000.0   
                                 0.0       8.0      7.0       10               1000.0   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                  -1.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10               1000.0   
                                                              1                1000.0   
                                           8.0      5.0       10               1000.0   
                                 0.5       8.0      4.0       10               1000.0   
                                           16.0     4.0       10               1000.0   
                                 0.0       8.0      1.0       0                1000.0   
                                                              1                1000.0   
                                                              2                1000.0   
                                                              10               1000.0   
                                 0.1       8.0      1.0       0                1000.0   
                                 0.0       32.0     1.0       10               1000.0   
                                 0.1       8.0      2.0       5                1000.0   
                                 0.0       8.0      0.5       10               1000.0   
...                                                                               ...   
                                 0.1       4.0      3.0       1                1000.0   
                                           16.0     3.0       10               1000.0   
                                 0.0       16.0     2.0       2                1000.0   
                                                              10               1000.0   
                                                              1                1000.0   
                                                              0                1000.0   
                100.0    18077.0 0.1       16.0     1.0       10                100.0   
                1000.0   18077.0 0.5       4.0      3.0       10               1000.0   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                  -1.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                1000.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                1000.0   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                  -1.0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                1000.0   
                                                    0.1       0                1000.0   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                100.0   
                1000.0   9000.0  0.1       8.0      3.0       2                1000.0   
                         8000.0  0.1       8.0      3.0       2                1000.0   
                         7000.0  0.1       8.0      3.0       2                1000.0   
                         6000.0  0.1       8.0      3.0       2                1000.0   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                  -1.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                1000.0   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                  -1.0   
                         1000.0  0.0       1000.0  -1.0       0                  -1.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                 100.0   
                                                    1.0       0                 100.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                1000.0   
                100.0    1000.0  0.1       16.0     1.0       10                100.0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                 100.0   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                  -1.0   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                1000.0   

                                                                                                                      predNew  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                                                           NaN   
                                                    2.0       1                                                           NaN   
                                 0.0       8.0      3.0       0                                                           NaN   
                                                              2                                                           NaN   
                                                              1                                                           NaN   
                                                              10                                                          NaN   
                                 0.1       8.0      3.0       0                                                           NaN   
                                           4.0      1.0       1                                                           NaN   
                                           8.0      2.0       2                                                           NaN   
                                                              4                                                           NaN   
                                           16.0     4.0       10                                                          NaN   
                                 0.0       8.0      7.0       10                                                          NaN   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                                                          NaN   
                                                              1                                                           NaN   
                                           8.0      5.0       10                                                          NaN   
                                 0.5       8.0      4.0       10                                                          NaN   
                                           16.0     4.0       10                                                          NaN   
                                 0.0       8.0      1.0       0                                                           NaN   
                                                              1                                                           NaN   
                                                              2                                                           NaN   
                                                              10                                                          NaN   
                                 0.1       8.0      1.0       0                                                           NaN   
                                 0.0       32.0     1.0       10                                                          NaN   
                                 0.1       8.0      2.0       5                                                           NaN   
                                 0.0       8.0      0.5       10                                                          NaN   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1                                                           NaN   
                                           16.0     3.0       10                                                          NaN   
                                 0.0       16.0     2.0       2                                                           NaN   
                                                              10                                                          NaN   
                                                              1                                                           NaN   
                                                              0                                                           NaN   
                100.0    18077.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   18077.0 0.5       4.0      3.0       10                                                          NaN   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                                                           NaN   
                                                    0.1       0                                                           NaN   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   9000.0  0.1       8.0      3.0       2                                                           NaN   
                         8000.0  0.1       8.0      3.0       2                                                           NaN   
                         7000.0  0.1       8.0      3.0       2                                                           NaN   
                         6000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                         1000.0  0.0       1000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                                                           NaN   
                                                    1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                                                           NaN   
                100.0    1000.0  0.1       16.0     1.0       10                                                          NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                                                           NaN   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                                                           NaN   

                                                                           rotateMaxAgl  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                       0   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                       0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                       2   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                       0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                       2   
                                                    2.0       1                       1   
                                 0.0       8.0      3.0       0                       0   
                                                              2                       2   
                                                              1                       1   
                                                              10                     10   
                                 0.1       8.0      3.0       0                       0   
                                           4.0      1.0       1                       1   
                                           8.0      2.0       2                       2   
                                                              4                       4   
                                           16.0     4.0       10                     10   
                                 0.0       8.0      7.0       10                     10   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                       0   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                     10   
                                                              1                       1   
                                           8.0      5.0       10                     10   
                                 0.5       8.0      4.0       10                     10   
                                           16.0     4.0       10                     10   
                                 0.0       8.0      1.0       0                       0   
                                                              1                       1   
                                                              2                       2   
                                                              10                     10   
                                 0.1       8.0      1.0       0                       0   
                                 0.0       32.0     1.0       10                     10   
                                 0.1       8.0      2.0       5                       5   
                                 0.0       8.0      0.5       10                     10   
...                                                                                 ...   
                                 0.1       4.0      3.0       1                       1   
                                           16.0     3.0       10                     10   
                                 0.0       16.0     2.0       2                       2   
                                                              10                     10   
                                                              1                       1   
                                                              0                       0   
                100.0    18077.0 0.1       16.0     1.0       10                     10   
                1000.0   18077.0 0.5       4.0      3.0       10                     10   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                       0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                       0   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                       2   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                       0   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                       0   
                                                    0.1       0                       0   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                     10   
                1000.0   9000.0  0.1       8.0      3.0       2                       2   
                         8000.0  0.1       8.0      3.0       2                       2   
                         7000.0  0.1       8.0      3.0       2                       2   
                         6000.0  0.1       8.0      3.0       2                       2   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                       0   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                       2   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                       0   
                         1000.0  0.0       1000.0  -1.0       0                       0   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                       0   
                                                    1.0       0                       0   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                       2   
                100.0    1000.0  0.1       16.0     1.0       10                     10   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                       0   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                       0   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                       2   

                                                                           rotatePby  
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                    0  
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                    0  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                  0.1  
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                    0  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                  0.1  
                                                    2.0       1                  0.1  
                                 0.0       8.0      3.0       0                    0  
                                                              2                    0  
                                                              1                    0  
                                                              10                   0  
                                 0.1       8.0      3.0       0                  0.1  
                                           4.0      1.0       1                  0.1  
                                           8.0      2.0       2                  0.1  
                                                              4                  0.1  
                                           16.0     4.0       10                 0.1  
                                 0.0       8.0      7.0       10                   0  
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                    0  
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                   0  
                                                              1                    0  
                                           8.0      5.0       10                   0  
                                 0.5       8.0      4.0       10                 0.5  
                                           16.0     4.0       10                 0.5  
                                 0.0       8.0      1.0       0                    0  
                                                              1                    0  
                                                              2                    0  
                                                              10                   0  
                                 0.1       8.0      1.0       0                  0.1  
                                 0.0       32.0     1.0       10                   0  
                                 0.1       8.0      2.0       5                  0.1  
                                 0.0       8.0      0.5       10                   0  
...                                                                              ...  
                                 0.1       4.0      3.0       1                  0.1  
                                           16.0     3.0       10                 0.1  
                                 0.0       16.0     2.0       2                    0  
                                                              10                   0  
                                                              1                    0  
                                                              0                    0  
                100.0    18077.0 0.1       16.0     1.0       10                 0.1  
                1000.0   18077.0 0.5       4.0      3.0       10                 0.5  
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                    0  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                    0  
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                  0.1  
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                    0  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                    0  
                                                    0.1       0                    0  
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                 0.1  
                1000.0   9000.0  0.1       8.0      3.0       2                  0.1  
                         8000.0  0.1       8.0      3.0       2                  0.1  
                         7000.0  0.1       8.0      3.0       2                  0.1  
                         6000.0  0.1       8.0      3.0       2                  0.1  
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                    0  
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                  0.1  
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                    0  
                         1000.0  0.0       1000.0  -1.0       0                    0  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                    0  
                                                    1.0       0                    0  
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                  0.1  
                100.0    1000.0  0.1       16.0     1.0       10                 0.1  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                    0  
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                    0  
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                  0.1  

[120 rows x 14 columns]
In [11]:
%run img_utils.py
srchParamsDct = {
    'nObsFit' : [100, 1000, 5000, 6000, 7000, 8000, 9000, 10000, glbObsFitFtr.shape[0]],
#     'nObsFit' : [100, 1000, 5000, 10000, 
#                     glbObsFitFtr.shape[0], glbObsTrnFtr.shape[0]]
    'nObsBtc' : [8],    
#     'nObsBtc' : [4, 8, 16, 32],        
    'rotatePby' : [0.1],
#     'rotatePby' : [0.0, 0.1, 0.2, 0.5],    
    'rotateMaxAgl' : [2],
#     'rotateMaxAgl' : [0, 1, 10],    
    'nStepsTfw' : [1000],
#     'nStepsTfw' : [100, 1000, 10000],    
    'lrnRateTfw' : [3.0]
#     'lrnRateTfw' : [0.1, 0.5, 1.0, 5.0, 7.0, 10.0]    
                }

jnk = mysearchParams(fitMdlLgtRgrSGDTfw, srchParamsDct = srchParamsDct,
                     curResultsDf = glbMdlDf, 
               mode = 'displayonly', 
        sort_values    = ['nObsFit', 'accVld', 'logLossVld', 'duration'],
        sort_ascending = [False    , True    , False,        False],
                save_drop_cols = 'model',     
                save_filepathname = glbPickleFile['models'],
              lclXFit = glbXFit, lclYFit = glbYFit) 

# thsDf, thsObsVldRspPredProba, thsObsNewRspPredProba = fitMdlLgtRgrTfw(
#     glbXFit, glbYFit, 
#     nObsFit = 100, nStepsTfw = 10, lrnRateTfw = 0.5,
#     visualize = False, newObs = False, verbose = False)
mysearchParams: will run <function fitMdlLgtRgrSGDTfw at 0x121d9bf50> with params:
Empty DataFrame
Columns: [nStepsTfw, nObsFit, rotatePby, nObsBtc, lrnRateTfw, rotateMaxAgl]
Index: []
mysearchParams: total runs: 0
In [25]:
%run img_utils.py

glbMdlDf = mysearchParams(fitMdlLgtRgrSGDTfw, srchParamsDct = srchParamsDct,
                     curResultsDf = glbMdlDf, 
               mode = 'run', 
        sort_values    = ['nObsFit', 'accVld', 'logLossVld', 'duration'],
        sort_ascending = [False    , False    , True,        True],       
                save_filepathname = glbPickleFile['models'],
                save_drop_cols = 'model',          
              lclXFit = glbXFit, lclYFit = glbYFit)
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:124: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:143: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:126: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
mysearchParams: running <function fitMdlLgtRgrSGDTfw at 0x1181d3f50> with params:
nStepsTfw       1000
nObsFit         6000
rotatePby        0.1
nObsBtc            8
lrnRateTfw         3
rotateMaxAgl       2

Logistic Regression (TensorFlow): nObsFit: 6000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nStepsTfw: 1000; lrnRateTfw:3.0000 
  visualize: False; newObs: False; verbose: False
  duration: 09 seconds
mysearchParams: running <function fitMdlLgtRgrSGDTfw at 0x1181d3f50> with params:
nStepsTfw       1000
nObsFit         7000
rotatePby        0.1
nObsBtc            8
lrnRateTfw         3
rotateMaxAgl       2

Logistic Regression (TensorFlow): nObsFit: 7000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nStepsTfw: 1000; lrnRateTfw:3.0000 
  visualize: False; newObs: False; verbose: False
  duration: 09 seconds
mysearchParams: running <function fitMdlLgtRgrSGDTfw at 0x1181d3f50> with params:
nStepsTfw       1000
nObsFit         8000
rotatePby        0.1
nObsBtc            8
lrnRateTfw         3
rotateMaxAgl       2

Logistic Regression (TensorFlow): nObsFit: 8000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nStepsTfw: 1000; lrnRateTfw:3.0000 
  visualize: False; newObs: False; verbose: False
  duration: 09 seconds
mysearchParams: running <function fitMdlLgtRgrSGDTfw at 0x1181d3f50> with params:
nStepsTfw       1000
nObsFit         9000
rotatePby        0.1
nObsBtc            8
lrnRateTfw         3
rotateMaxAgl       2

Logistic Regression (TensorFlow): nObsFit: 9000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nStepsTfw: 1000; lrnRateTfw:3.0000 
  visualize: False; newObs: False; verbose: False
  duration: 09 seconds
                                                                                                                    accVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'accCls': [0.504132231405, 0.435146443515, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             {u'accCls': [0.448347107438, 0.44769874477, 0....   
                                                    2.0       1             {u'accCls': [0.338842975207, 0.347280334728, 0...   
                                 0.0       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              2             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              1             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              10            {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                 0.1       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                           4.0      1.0       1             {u'accCls': [0.52479338843, 0.575313807531, 0....   
                                           8.0      2.0       2             {u'accCls': [0.146694214876, 0.5, 0.2123893805...   
                                                              4             {u'accCls': [0.384297520661, 0.297071129707, 0...   
                                           16.0     4.0       10            {u'accCls': [0.510330578512, 0.389121338912, 0...   
                                 0.0       8.0      7.0       10            {u'accCls': [0.421487603306, 0.410041841004, 0...   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                                              1             {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                           8.0      5.0       10            {u'accCls': [0.338842975207, 0.173640167364, 0...   
                                 0.5       8.0      4.0       10            {u'accCls': [0.421487603306, 0.558577405858, 0...   
                                           16.0     4.0       10            {u'accCls': [0.396694214876, 0.0836820083682, ...   
                                 0.0       8.0      1.0       0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              1             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              2             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              10            {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                 0.1       8.0      1.0       0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                 0.0       32.0     1.0       10            {u'accCls': [0.588842975207, 0.133891213389, 0...   
                                 0.1       8.0      2.0       5             {u'accCls': [0.276859504132, 0.219665271967, 0...   
                                 0.0       8.0      0.5       10            {u'accCls': [0.365702479339, 0.119246861925, 0...   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1             {u'accCls': [0.545454545455, 0.0690376569038, ...   
                                           16.0     3.0       10            {u'accCls': [0.528925619835, 0.0523012552301, ...   
                                 0.0       16.0     2.0       2             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              10            {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              1             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              0             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   18077.0 0.5       4.0      3.0       10            {u'accCls': [0.297520661157, 0.081589958159, 0...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'accCls': [0.456611570248, 0.380753138075, 0...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             {u'accCls': [0.289256198347, 0.182008368201, 0...   
                                                    0.1       0             {u'accCls': [0.169421487603, 0.144351464435, 0...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   9000.0  0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
                         8000.0  0.1       8.0      3.0       2             {u'accCls': [0.553719008264, 0.610878661088, 0...   
                         7000.0  0.1       8.0      3.0       2             {u'accCls': [0.431818181818, 0.558577405858, 0...   
                         6000.0  0.1       8.0      3.0       2             {u'accCls': [0.181818181818, 0.671548117155, 0...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             {u'accCls': [0.543388429752, 0.535564853556, 0...   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN   
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             {u'accCls': [0.646694214876, 0.0564853556485, ...   
                                                    1.0       0             {u'accCls': [0.423553719008, 0.182008368201, 0...   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             {u'accCls': [0.204545454545, 0.0334728033473, ...   
                100.0    1000.0  0.1       16.0     1.0       10            {u'accCls': [0.136363636364, 0.0230125523013, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'accCls': [0.150826446281, 0.142259414226, 0...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'accCls': [0.0185950413223, 0.133891213389, ...   

                                                                           bestFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0              False   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2               True   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2              False   
                                                    2.0       1              False   
                                 0.0       8.0      3.0       0              False   
                                                              2              False   
                                                              1              False   
                                                              10             False   
                                 0.1       8.0      3.0       0              False   
                                           4.0      1.0       1              False   
                                           8.0      2.0       2              False   
                                                              4              False   
                                           16.0     4.0       10             False   
                                 0.0       8.0      7.0       10             False   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10             False   
                                                              1              False   
                                           8.0      5.0       10             False   
                                 0.5       8.0      4.0       10             False   
                                           16.0     4.0       10             False   
                                 0.0       8.0      1.0       0              False   
                                                              1              False   
                                                              2              False   
                                                              10             False   
                                 0.1       8.0      1.0       0              False   
                                 0.0       32.0     1.0       10             False   
                                 0.1       8.0      2.0       5              False   
                                 0.0       8.0      0.5       10             False   
...                                                                            ...   
                                 0.1       4.0      3.0       1              False   
                                           16.0     3.0       10             False   
                                 0.0       16.0     2.0       2              False   
                                                              10             False   
                                                              1              False   
                                                              0              False   
                100.0    18077.0 0.1       16.0     1.0       10             False   
                1000.0   18077.0 0.5       4.0      3.0       10             False   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0              False   
                                                    0.1       0              False   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             False   
                1000.0   9000.0  0.1       8.0      3.0       2                NaN   
                         8000.0  0.1       8.0      3.0       2                NaN   
                         7000.0  0.1       8.0      3.0       2                NaN   
                         6000.0  0.1       8.0      3.0       2                NaN   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0              False   
                         1000.0  0.0       1000.0  -1.0       0              False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              False   
                                                    1.0       0              False   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              False   
                100.0    1000.0  0.1       16.0     1.0       10             False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              False   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              False   

                                                                            logLossVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0               0.018463   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0               0.193149   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              19.209913   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2              17.898932   
                                                    2.0       1              20.091985   
                                 0.0       8.0      3.0       0              20.948740   
                                                              2              20.948740   
                                                              1              20.948740   
                                                              10             20.948740   
                                 0.1       8.0      3.0       0              20.948740   
                                           4.0      1.0       1              19.602959   
                                           8.0      2.0       2              19.997834   
                                                              4              20.635511   
                                           16.0     4.0       10             21.347350   
                                 0.0       8.0      7.0       10             21.886713   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0               3.116799   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10             22.423282   
                                                              1              22.423282   
                                           8.0      5.0       10             22.167039   
                                 0.5       8.0      4.0       10             22.007029   
                                           16.0     4.0       10             21.561740   
                                 0.0       8.0      1.0       0              19.594075   
                                                              1              19.594075   
                                                              2              19.594075   
                                                              10             19.594075   
                                 0.1       8.0      1.0       0              19.594075   
                                 0.0       32.0     1.0       10             16.835064   
                                 0.1       8.0      2.0       5              21.457194   
                                 0.0       8.0      0.5       10             16.048818   
...                                                                                ...   
                                 0.1       4.0      3.0       1              26.212732   
                                           16.0     3.0       10             25.966046   
                                 0.0       16.0     2.0       2              25.605293   
                                                              10             25.605293   
                                                              1              25.605293   
                                                              0              25.605293   
                100.0    18077.0 0.1       16.0     1.0       10             24.085776   
                1000.0   18077.0 0.5       4.0      3.0       10             26.843734   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0               3.085191   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              18.995890   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0               2.885114   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0               9.502959   
                                                    0.1       0               8.912652   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             24.085776   
                1000.0   9000.0  0.1       8.0      3.0       2              20.546733   
                         8000.0  0.1       8.0      3.0       2              20.345963   
                         7000.0  0.1       8.0      3.0       2              20.307083   
                         6000.0  0.1       8.0      3.0       2              21.354761   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0               2.610439   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              21.899301   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0               2.498749   
                         1000.0  0.0       1000.0  -1.0       0               2.539650   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              24.274683   
                                                    1.0       0              14.714048   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              25.728109   
                100.0    1000.0  0.1       16.0     1.0       10             18.141110   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              12.600104   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0               2.497940   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              25.837055   

                                                                                                                      predNew  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                                                           NaN   
                                                    2.0       1                                                           NaN   
                                 0.0       8.0      3.0       0                                                           NaN   
                                                              2                                                           NaN   
                                                              1                                                           NaN   
                                                              10                                                          NaN   
                                 0.1       8.0      3.0       0                                                           NaN   
                                           4.0      1.0       1                                                           NaN   
                                           8.0      2.0       2                                                           NaN   
                                                              4                                                           NaN   
                                           16.0     4.0       10                                                          NaN   
                                 0.0       8.0      7.0       10                                                          NaN   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                                                          NaN   
                                                              1                                                           NaN   
                                           8.0      5.0       10                                                          NaN   
                                 0.5       8.0      4.0       10                                                          NaN   
                                           16.0     4.0       10                                                          NaN   
                                 0.0       8.0      1.0       0                                                           NaN   
                                                              1                                                           NaN   
                                                              2                                                           NaN   
                                                              10                                                          NaN   
                                 0.1       8.0      1.0       0                                                           NaN   
                                 0.0       32.0     1.0       10                                                          NaN   
                                 0.1       8.0      2.0       5                                                           NaN   
                                 0.0       8.0      0.5       10                                                          NaN   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1                                                           NaN   
                                           16.0     3.0       10                                                          NaN   
                                 0.0       16.0     2.0       2                                                           NaN   
                                                              10                                                          NaN   
                                                              1                                                           NaN   
                                                              0                                                           NaN   
                100.0    18077.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   18077.0 0.5       4.0      3.0       10                                                          NaN   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                                                           NaN   
                                                    0.1       0                                                           NaN   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   9000.0  0.1       8.0      3.0       2                                                           NaN   
                         8000.0  0.1       8.0      3.0       2                                                           NaN   
                         7000.0  0.1       8.0      3.0       2                                                           NaN   
                         6000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                         1000.0  0.0       1000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                                                           NaN   
                                                    1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                                                           NaN   
                100.0    1000.0  0.1       16.0     1.0       10                                                          NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                                                           NaN   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                                                           NaN   

                                                                                                                logLossVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'logLossCls': [1.72596805748, 1.7853875361, ...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             {u'logLossCls': [1.7477126908, 1.45845704706, ...   
                                                    2.0       1             {u'logLossCls': [2.4098162987, 2.1249522721, 2...   
                                 0.0       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              2             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              1             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              10            {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                 0.1       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                           4.0      1.0       1             {u'logLossCls': [1.47759900586, 1.5216033003, ...   
                                           8.0      2.0       2             {u'logLossCls': [2.96027056113, 1.55809628297,...   
                                                              4             {u'logLossCls': [2.1684078246, 2.40346788464, ...   
                                           16.0     4.0       10            {u'logLossCls': [1.79621628564, 1.99717570497,...   
                                 0.0       8.0      7.0       10            {u'logLossCls': [2.16842694926, 2.08737047825,...   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                                              1             {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                           8.0      5.0       10            {u'logLossCls': [2.49658612049, 3.01094383144,...   
                                 0.5       8.0      4.0       10            {u'logLossCls': [2.1293109356, 1.52307431523, ...   
                                           16.0     4.0       10            {u'logLossCls': [2.13819531033, 3.35150390363,...   
                                 0.0       8.0      1.0       0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              1             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              2             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              10            {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                 0.1       8.0      1.0       0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                 0.0       32.0     1.0       10            {u'logLossCls': [1.3367673536, 2.19949472069, ...   
                                 0.1       8.0      2.0       5             {u'logLossCls': [2.47060812006, 2.55482495458,...   
                                 0.0       8.0      0.5       10            {u'logLossCls': [1.73155548863, 2.32786043541,...   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1             {u'logLossCls': [1.71708309944, 3.4968377777, ...   
                                           16.0     3.0       10            {u'logLossCls': [1.71310413171, 3.4687167196, ...   
                                 0.0       16.0     2.0       2             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              10            {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              1             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              0             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   18077.0 0.5       4.0      3.0       10            {u'logLossCls': [2.62356084168, 3.42588099594,...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'logLossCls': [1.84540699409, 1.93896956479,...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             {u'logLossCls': [1.14059053163, 1.46723165909,...   
                                                    0.1       0             {u'logLossCls': [1.11536194976, 1.25718941188,...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   9000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
                         8000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.5257602538, 1.31972597838, ...   
                         7000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.06754908637, 1.51088086827,...   
                         6000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.97387028973, 1.20522205183,...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.57533202071, 1.59023941247,...   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN   
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             {u'logLossCls': [1.28781316316, 3.51519487621,...   
                                                    1.0       0             {u'logLossCls': [0.842354858019, 1.17531354279...   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.84808429073, 3.58756550329,...   
                100.0    1000.0  0.1       16.0     1.0       10            {u'logLossCls': [2.1826821181, 3.34540505739, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'logLossCls': [1.47411393905, 2.08387227918,...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'logLossCls': [3.67759601248, 3.22267129616,...   

                                                                              accVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             1.000000   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             0.987348   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             0.375201   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             0.361859   
                                                    2.0       1             0.357488   
                                 0.0       8.0      3.0       0             0.357028   
                                                              2             0.357028   
                                                              1             0.357028   
                                                              10            0.357028   
                                 0.1       8.0      3.0       0             0.357028   
                                           4.0      1.0       1             0.355648   
                                           8.0      2.0       2             0.351737   
                                                              4             0.348516   
                                           16.0     4.0       10            0.346216   
                                 0.0       8.0      7.0       10            0.346216   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             0.343685   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            0.338854   
                                                              1             0.338854   
                                           8.0      5.0       10            0.336784   
                                 0.5       8.0      4.0       10            0.334484   
                                           16.0     4.0       10            0.331723   
                                 0.0       8.0      1.0       0             0.331493   
                                                              1             0.331493   
                                                              2             0.331493   
                                                              10            0.331493   
                                 0.1       8.0      1.0       0             0.331493   
                                 0.0       32.0     1.0       10            0.328042   
                                 0.1       8.0      2.0       5             0.325512   
                                 0.0       8.0      0.5       10            0.325052   
...                                                                              ...   
                                 0.1       4.0      3.0       1             0.226823   
                                           16.0     3.0       10            0.219692   
                                 0.0       16.0     2.0       2             0.214861   
                                                              10            0.214861   
                                                              1             0.214861   
                                                              0             0.214861   
                100.0    18077.0 0.1       16.0     1.0       10            0.210950   
                1000.0   18077.0 0.5       4.0      3.0       10            0.208420   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             0.342535   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             0.384173   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             0.358638   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             0.319991   
                                                    0.1       0             0.251208   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            0.210950   
                1000.0   9000.0  0.1       8.0      3.0       2             0.381643   
                         8000.0  0.1       8.0      3.0       2             0.378882   
                         7000.0  0.1       8.0      3.0       2             0.375431   
                         6000.0  0.1       8.0      3.0       2             0.339545   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             0.363699   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             0.320911   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0             0.341385   
                         1000.0  0.0       1000.0  -1.0       0             0.333333   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             0.273522   
                                                    1.0       0             0.255809   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             0.224983   
                100.0    1000.0  0.1       16.0     1.0       10            0.212790   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             0.173453   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             0.307108   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             0.224753   

                                                                            duration  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                  874   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                  743   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                   11   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                  519   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                    9   
                                                    2.0       1                   10   
                                 0.0       8.0      3.0       0                    8   
                                                              2                    8   
                                                              1                    9   
                                                              10                  10   
                                 0.1       8.0      3.0       0                   10   
                                           4.0      1.0       1                    8   
                                           8.0      2.0       2                   10   
                                                              4                   13   
                                           16.0     4.0       10                  14   
                                 0.0       8.0      7.0       10                   9   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                  597   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                   8   
                                                              1                    8   
                                           8.0      5.0       10                   9   
                                 0.5       8.0      4.0       10                  15   
                                           16.0     4.0       10                  24   
                                 0.0       8.0      1.0       0                    8   
                                                              1                    8   
                                                              2                    8   
                                                              10                   9   
                                 0.1       8.0      1.0       0                   13   
                                 0.0       32.0     1.0       10                  16   
                                 0.1       8.0      2.0       5                   10   
                                 0.0       8.0      0.5       10                   9   
...                                                                              ...   
                                 0.1       4.0      3.0       1                    9   
                                           16.0     3.0       10                  13   
                                 0.0       16.0     2.0       2                   10   
                                                              10                  11   
                                                              1                   11   
                                                              0                   11   
                100.0    18077.0 0.1       16.0     1.0       10                   2   
                1000.0   18077.0 0.5       4.0      3.0       10                  12   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                  514   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                  288   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                  317   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                  301   
                                                    0.1       0                  295   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                   2   
                1000.0   9000.0  0.1       8.0      3.0       2                    9   
                         8000.0  0.1       8.0      3.0       2                    9   
                         7000.0  0.1       8.0      3.0       2                    9   
                         6000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                  150   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                   55   
                         1000.0  0.0       1000.0  -1.0       0                   28   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                    7   
                                                    1.0       0                    5   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                    9   
                100.0    1000.0  0.1       16.0     1.0       10                   2   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                    5   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                    8   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                    9   

                                                                                                                        model  
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                     
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN  
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                                                           NaN  
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                                                           NaN  
                                                    2.0       1                                                           NaN  
                                 0.0       8.0      3.0       0                                                           NaN  
                                                              2                                                           NaN  
                                                              1                                                           NaN  
                                                              10                                                          NaN  
                                 0.1       8.0      3.0       0                                                           NaN  
                                           4.0      1.0       1                                                           NaN  
                                           8.0      2.0       2                                                           NaN  
                                                              4                                                           NaN  
                                           16.0     4.0       10                                                          NaN  
                                 0.0       8.0      7.0       10                                                          NaN  
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                                                          NaN  
                                                              1                                                           NaN  
                                           8.0      5.0       10                                                          NaN  
                                 0.5       8.0      4.0       10                                                          NaN  
                                           16.0     4.0       10                                                          NaN  
                                 0.0       8.0      1.0       0                                                           NaN  
                                                              1                                                           NaN  
                                                              2                                                           NaN  
                                                              10                                                          NaN  
                                 0.1       8.0      1.0       0                                                           NaN  
                                 0.0       32.0     1.0       10                                                          NaN  
                                 0.1       8.0      2.0       5                                                           NaN  
                                 0.0       8.0      0.5       10                                                          NaN  
...                                                                                                                       ...  
                                 0.1       4.0      3.0       1                                                           NaN  
                                           16.0     3.0       10                                                          NaN  
                                 0.0       16.0     2.0       2                                                           NaN  
                                                              10                                                          NaN  
                                                              1                                                           NaN  
                                                              0                                                           NaN  
                100.0    18077.0 0.1       16.0     1.0       10                                                          NaN  
                1000.0   18077.0 0.5       4.0      3.0       10                                                          NaN  
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                                                           NaN  
                                                    0.1       0                                                           NaN  
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                                                          NaN  
                1000.0   9000.0  0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
                         8000.0  0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
                         7000.0  0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
                         6000.0  0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN  
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                                                           NaN  
                                                    1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
                100.0    1000.0  0.1       16.0     1.0       10                                                          NaN  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                                                           NaN  
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  

[120 rows x 8 columns]
Compressed pickle file: data/img_M_SFDD_ImgSz_64.pickle; size: 41 KB
In [16]:
lrn10Srs = glbMdlDf.ix[('LgtRgr.tfw',  1000.0,   18077.0,  10.0)]
# print lrn10Srs
lrn01Srs = glbMdlDf.ix[('LgtRgr.tfw',  1000.0,   18077.0,   1.0)]
# print lrn01Srs

print "lrn10Srs: accVld: %.4f" % (lrn10Srs['accVld'])
print "lrn01Srs: accVld: %.4f" % (lrn01Srs['accVld'])
print "lrn10-01: accVldDff: %.4f" % (lrn10Srs['accVld'] - lrn01Srs['accVld'])

print "lrn10Srs: accVldCls:"; print (lrn10Srs['accVldCls']['accCls'])
print "lrn01Srs: accVldCls:"; print (lrn01Srs['accVldCls']['accCls'])
print "lrn10-01: accVldClsDff:"; print (lrn10Srs['accVldCls']['accCls'] - 
                                        lrn01Srs['accVldCls']['accCls'])

print "\n"
print "lrn10Srs: logLossVld: %8.4f" % (lrn10Srs['logLossVld'])
print "lrn01Srs: logLossVld: %8.4f" % (lrn01Srs['logLossVld'])
print "lrn10-01: logLossVldDff: %8.4f" % (lrn10Srs['logLossVld'] - 
                                          lrn01Srs['logLossVld'])

print "lrn10Srs: logLossVldCls:"; print (lrn10Srs['logLossVldCls']['logLossCls'])
print "lrn01Srs: logLossVldCls:"; print (lrn01Srs['logLossVldCls']['logLossCls'])
print "lrn10-01: logLossVldClsDff:"; 
print (lrn10Srs['logLossVldCls']['logLossCls'] - 
       lrn01Srs['logLossVldCls']['logLossCls'])
lrn10Srs: accVld: 0.3752
lrn01Srs: accVld: 0.3202
lrn10-01: accVldDff: 0.0550
lrn10Srs: accVldCls:
[ 0.5041  0.4351  0.3805  0.1738  0.3965  0.2464  0.6749  0.5143  0.25
  0.1637]
lrn01Srs: accVldCls:
[ 0.3264  0.2092  0.2323  0.2144  0.3878  0.1588  0.6637  0.6286  0.2088
  0.219 ]
lrn10-01: accVldClsDff:
[ 0.1777  0.2259  0.1482 -0.0406  0.0087  0.0877  0.0113 -0.1143  0.0412
 -0.0553]


lrn10Srs: logLossVld:  19.2099
lrn01Srs: logLossVld:   9.4750
lrn10-01: logLossVldDff:   9.7349
lrn10Srs: logLossVldCls:
[ 1.726   1.7854  1.8043  2.6157  1.9122  2.3841  0.9763  1.0939  1.9704
  2.9416]
lrn01Srs: logLossVldCls:
[ 1.0565  1.4437  0.9226  1.0162  0.8034  1.5807  0.2146  0.2664  0.879
  1.2919]
lrn10-01: logLossVldClsDff:
[ 0.6695  0.3417  0.8817  1.5995  1.1088  0.8034  0.7616  0.8275  1.0915
  1.6497]
In [43]:
# Set value based on condition

# print glbMdlDf.ix[glbMdlDf['id'].str.contains('LogisticRegression.SGD.tf', 
#                                               na=False), 'id']
# glbMdlDf.ix[glbMdlDf['id'].str.contains('LogisticRegression.SGD.tf', 
#                                               na=False), 'id'] = 'LgtRgr.SGD.tf'
# print glbMdlDf.ix[glbMdlDf['id'].str.contains('LogisticRegression.SGD.tf', 
#                                               na=False), 'id']

def lclfixNanDf(df, column, default):
    print "\n Before:"
    dspDf = df[[column]]
    dspDf[column + '.isnull'] = df[column].isnull()
    print dspDf.to_string(index = False)
    
    df.loc[df[column].isnull(), column] = default
    
    print "\n After:"
    dspDf = df[[column]]
    dspDf[column + '.isnull'] = df[column].isnull()
    print dspDf.to_string(index = False)    
    return(df)

# tmpMdlDf = lclfixNanDf(glbMdlDf, column = 'rotatePby', default = 0)

# print glbMdlDf.ix[- glbMdlDf['nStepsTfw'].isnull(), ['id', 'nStepsTfw']]
# glbMdlDf.ix[- glbMdlDf['nStepsTfw'].isnull(), 'id'] = 'LogisticRegression.tf'
# print glbMdlDf.ix[- glbMdlDf['nStepsTfw'].isnull(), ['id', 'nStepsTfw']]

# print glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), ['nObsBtc', 'nObsFit']]
# # glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), 'nObsBtc'] = \
# #     glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), 'nObsFit']
# glbMdlDf['nObsBtc'] = glbMdlDf.apply(
#     lambda (row): row['nObsFit'] if pd.isnull(row['nObsBtc']) else row['nObsBtc'],
#                         axis = 1)
# print 'After:'    
# print glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), ['nObsBtc', 'nObsFit']]

# Change value
# tmpMdlDf = glbMdlDf
# print tmpMdlDf[(tmpMdlDf['id'].str.contains('LgtRgr.skl', na = False)) & 
#                (tmpMdlDf['nStepsTfw'] == 1.0)]
# print tmpMdlDf.ix[(tmpMdlDf['id'].str.contains('LgtRgr.skl', na = False)) & 
#                   (tmpMdlDf['nStepsTfw'] == 1.0), 'nStepsTfw']
# tmpMdlDf.ix[(tmpMdlDf['id'].str.contains('LgtRgr.skl', na = False)) & 
#                   (tmpMdlDf['nStepsTfw'] == 1.0), 'nStepsTfw'] = -1.0
# print 'After:'
# print tmpMdlDf

# Remove specific models
# mask = (glbMdlDf['id'].str.contains('LgtRgr.tfw', na = False))
# mask = (glbMdlDf['id'].str.contains('LgtRgr.tfw', na = False)) & \
#        (glbMdlDf['nObsFit'] == 10000.0)
# print mask
# tmpMdlDf = glbMdlDf[~mask]
# print tmpMdlDf

# Remove dups
# print glbMdlDf.columns
# print (glbMdlDf['logLossVld'])
# print (glbMdlDf.index.duplicated())
# tmpMdlDf = glbMdlDf[~glbMdlDf.index.duplicated()]
# print (tmpMdlDf.index.duplicated())

# glbMdlDf['nObsBtc'] = glbMdlDf['nObsFit'] 

# glbMdlDf = tmpMdlDf
# print 'After:'
# print glbMdlDf
print glbMdlDf['bestFit']
id              nStepsTfw  nObsFit  rotatePby  nObsBtc  lrnRateTfw  rotateMaxAgl
LgtRgr.skl      -1.0       22424.0  0.0        22424.0  -1.0        0               False
LgtRgr.tfw       1000.0    22424.0  0.0        22424.0   10.0       0                 NaN
                           18077.0  0.0        18077.0   10.0       0                True
LgtRgr.skl      -1.0       18077.0  0.0        18077.0  -1.0        0               False
LgtRgr.tfw       1000.0    18077.0  0.0        18077.0   1.0        0               False
LgtRgr.skl      -1.0       15000.0  0.0        15000.0  -1.0        0               False
LgtRgr.tfw       1000.0    10000.0  0.0        10000.0   10.0       0               False
LgtRgr.skl      -1.0       10000.0  0.0        10000.0  -1.0        0               False
LgtRgr.tfw       1000.0    10000.0  0.0        10000.0   1.0        0               False
                                                         0.1        0               False
LgtRgr.skl      -1.0       5000.0   0.0        5000.0   -1.0        0               False
                           2000.0   0.0        2000.0   -1.0        0               False
                           1000.0   0.0        1000.0   -1.0        0               False
LgtRgr.tfw       100.0     1000.0   0.0        1000.0    10.0       0               False
                                                         1.0        0               False
LgtRgr.SGD.tfw   100.0     1000.0   0.1        16.0      1.0        10                NaN
LgtRgr.tfw       100.0     1000.0   0.0        1000.0    0.1        0               False
LgtRgr.skl      -1.0       100.0    0.0        100.0    -1.0        0               False
Name: bestFit, dtype: object
In [ ]:
 
In [37]:
myexportDf(glbMdlDf, 
           save_filepathname = glbPickleFile['models'],
           save_drop_cols = 'model'
          )
Compressed pickle file: data/img_M_SFDD_ImgSz_64.pickle; size: 7 KB
In [12]:
glbMdlDf['bestFit'] = False
glbMdlDf.ix[(
 'LgtRgr.SGD.tfw', 1000.0,    18077.0, 0.1,       8.0,     3.0,        2), 
# LgtRgr.SGD.tfw   1000.0     18077.0  0.1        8.0      3.0         2            
# id               nStepsTfw  nObsFit  rotatePby  nObsBtc  lrnRateTfw  rotateMaxAgl
            'bestFit'] = True            
print glbMdlDf[list(set(glbMdlDf.columns) - set(srchParamsDct.keys()))]
# print glbMdlDf[glbMdlDf.nObsFit >= 10000][
#     list(set(glbMdlDf.columns) - set(srchParamsDct.keys()))]
                                                                                                                    accVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'accCls': [0.504132231405, 0.435146443515, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             {u'accCls': [0.448347107438, 0.44769874477, 0....   
                                                    2.0       1             {u'accCls': [0.338842975207, 0.347280334728, 0...   
                                 0.0       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              2             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              1             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              10            {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                 0.1       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                           4.0      1.0       1             {u'accCls': [0.52479338843, 0.575313807531, 0....   
                                           8.0      2.0       2             {u'accCls': [0.146694214876, 0.5, 0.2123893805...   
                                                              4             {u'accCls': [0.384297520661, 0.297071129707, 0...   
                                           16.0     4.0       10            {u'accCls': [0.510330578512, 0.389121338912, 0...   
                                 0.0       8.0      7.0       10            {u'accCls': [0.421487603306, 0.410041841004, 0...   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                                              1             {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                           8.0      5.0       10            {u'accCls': [0.338842975207, 0.173640167364, 0...   
                                 0.5       8.0      4.0       10            {u'accCls': [0.421487603306, 0.558577405858, 0...   
                                           16.0     4.0       10            {u'accCls': [0.396694214876, 0.0836820083682, ...   
                                 0.0       8.0      1.0       0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              1             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              2             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                              10            {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                 0.1       8.0      1.0       0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                 0.0       32.0     1.0       10            {u'accCls': [0.588842975207, 0.133891213389, 0...   
                                 0.1       8.0      2.0       5             {u'accCls': [0.276859504132, 0.219665271967, 0...   
                                 0.0       8.0      0.5       10            {u'accCls': [0.365702479339, 0.119246861925, 0...   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1             {u'accCls': [0.545454545455, 0.0690376569038, ...   
                                           16.0     3.0       10            {u'accCls': [0.528925619835, 0.0523012552301, ...   
                                 0.0       16.0     2.0       2             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              10            {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              1             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              0             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   18077.0 0.5       4.0      3.0       10            {u'accCls': [0.297520661157, 0.081589958159, 0...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'accCls': [0.456611570248, 0.380753138075, 0...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             {u'accCls': [0.289256198347, 0.182008368201, 0...   
                                                    0.1       0             {u'accCls': [0.169421487603, 0.144351464435, 0...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   9000.0  0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
                         8000.0  0.1       8.0      3.0       2             {u'accCls': [0.553719008264, 0.610878661088, 0...   
                         7000.0  0.1       8.0      3.0       2             {u'accCls': [0.431818181818, 0.558577405858, 0...   
                         6000.0  0.1       8.0      3.0       2             {u'accCls': [0.181818181818, 0.671548117155, 0...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             {u'accCls': [0.543388429752, 0.535564853556, 0...   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN   
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             {u'accCls': [0.646694214876, 0.0564853556485, ...   
                                                    1.0       0             {u'accCls': [0.423553719008, 0.182008368201, 0...   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             {u'accCls': [0.204545454545, 0.0334728033473, ...   
                100.0    1000.0  0.1       16.0     1.0       10            {u'accCls': [0.136363636364, 0.0230125523013, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'accCls': [0.150826446281, 0.142259414226, 0...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'accCls': [0.0185950413223, 0.133891213389, ...   

                                                                           bestFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0              False   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2               True   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2              False   
                                                    2.0       1              False   
                                 0.0       8.0      3.0       0              False   
                                                              2              False   
                                                              1              False   
                                                              10             False   
                                 0.1       8.0      3.0       0              False   
                                           4.0      1.0       1              False   
                                           8.0      2.0       2              False   
                                                              4              False   
                                           16.0     4.0       10             False   
                                 0.0       8.0      7.0       10             False   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10             False   
                                                              1              False   
                                           8.0      5.0       10             False   
                                 0.5       8.0      4.0       10             False   
                                           16.0     4.0       10             False   
                                 0.0       8.0      1.0       0              False   
                                                              1              False   
                                                              2              False   
                                                              10             False   
                                 0.1       8.0      1.0       0              False   
                                 0.0       32.0     1.0       10             False   
                                 0.1       8.0      2.0       5              False   
                                 0.0       8.0      0.5       10             False   
...                                                                            ...   
                                 0.1       4.0      3.0       1              False   
                                           16.0     3.0       10             False   
                                 0.0       16.0     2.0       2              False   
                                                              10             False   
                                                              1              False   
                                                              0              False   
                100.0    18077.0 0.1       16.0     1.0       10             False   
                1000.0   18077.0 0.5       4.0      3.0       10             False   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0              False   
                                                    0.1       0              False   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             False   
                1000.0   9000.0  0.1       8.0      3.0       2              False   
                         8000.0  0.1       8.0      3.0       2              False   
                         7000.0  0.1       8.0      3.0       2              False   
                         6000.0  0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0              False   
                         1000.0  0.0       1000.0  -1.0       0              False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              False   
                                                    1.0       0              False   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              False   
                100.0    1000.0  0.1       16.0     1.0       10             False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              False   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              False   

                                                                            logLossVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0               0.018463   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0               0.193149   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              19.209913   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2              17.898932   
                                                    2.0       1              20.091985   
                                 0.0       8.0      3.0       0              20.948740   
                                                              2              20.948740   
                                                              1              20.948740   
                                                              10             20.948740   
                                 0.1       8.0      3.0       0              20.948740   
                                           4.0      1.0       1              19.602959   
                                           8.0      2.0       2              19.997834   
                                                              4              20.635511   
                                           16.0     4.0       10             21.347350   
                                 0.0       8.0      7.0       10             21.886713   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0               3.116799   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10             22.423282   
                                                              1              22.423282   
                                           8.0      5.0       10             22.167039   
                                 0.5       8.0      4.0       10             22.007029   
                                           16.0     4.0       10             21.561740   
                                 0.0       8.0      1.0       0              19.594075   
                                                              1              19.594075   
                                                              2              19.594075   
                                                              10             19.594075   
                                 0.1       8.0      1.0       0              19.594075   
                                 0.0       32.0     1.0       10             16.835064   
                                 0.1       8.0      2.0       5              21.457194   
                                 0.0       8.0      0.5       10             16.048818   
...                                                                                ...   
                                 0.1       4.0      3.0       1              26.212732   
                                           16.0     3.0       10             25.966046   
                                 0.0       16.0     2.0       2              25.605293   
                                                              10             25.605293   
                                                              1              25.605293   
                                                              0              25.605293   
                100.0    18077.0 0.1       16.0     1.0       10             24.085776   
                1000.0   18077.0 0.5       4.0      3.0       10             26.843734   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0               3.085191   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              18.995890   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0               2.885114   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0               9.502959   
                                                    0.1       0               8.912652   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             24.085776   
                1000.0   9000.0  0.1       8.0      3.0       2              20.546733   
                         8000.0  0.1       8.0      3.0       2              20.345963   
                         7000.0  0.1       8.0      3.0       2              20.307083   
                         6000.0  0.1       8.0      3.0       2              21.354761   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0               2.610439   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2              21.899301   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0               2.498749   
                         1000.0  0.0       1000.0  -1.0       0               2.539650   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0              24.274683   
                                                    1.0       0              14.714048   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2              25.728109   
                100.0    1000.0  0.1       16.0     1.0       10             18.141110   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              12.600104   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0               2.497940   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              25.837055   

                                                                                                                      predNew  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                                                           NaN   
                                                    2.0       1                                                           NaN   
                                 0.0       8.0      3.0       0                                                           NaN   
                                                              2                                                           NaN   
                                                              1                                                           NaN   
                                                              10                                                          NaN   
                                 0.1       8.0      3.0       0                                                           NaN   
                                           4.0      1.0       1                                                           NaN   
                                           8.0      2.0       2                                                           NaN   
                                                              4                                                           NaN   
                                           16.0     4.0       10                                                          NaN   
                                 0.0       8.0      7.0       10                                                          NaN   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                                                          NaN   
                                                              1                                                           NaN   
                                           8.0      5.0       10                                                          NaN   
                                 0.5       8.0      4.0       10                                                          NaN   
                                           16.0     4.0       10                                                          NaN   
                                 0.0       8.0      1.0       0                                                           NaN   
                                                              1                                                           NaN   
                                                              2                                                           NaN   
                                                              10                                                          NaN   
                                 0.1       8.0      1.0       0                                                           NaN   
                                 0.0       32.0     1.0       10                                                          NaN   
                                 0.1       8.0      2.0       5                                                           NaN   
                                 0.0       8.0      0.5       10                                                          NaN   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1                                                           NaN   
                                           16.0     3.0       10                                                          NaN   
                                 0.0       16.0     2.0       2                                                           NaN   
                                                              10                                                          NaN   
                                                              1                                                           NaN   
                                                              0                                                           NaN   
                100.0    18077.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   18077.0 0.5       4.0      3.0       10                                                          NaN   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                                                           NaN   
                                                    0.1       0                                                           NaN   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   9000.0  0.1       8.0      3.0       2                                                           NaN   
                         8000.0  0.1       8.0      3.0       2                                                           NaN   
                         7000.0  0.1       8.0      3.0       2                                                           NaN   
                         6000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                         1000.0  0.0       1000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                                                           NaN   
                                                    1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                                                           NaN   
                100.0    1000.0  0.1       16.0     1.0       10                                                          NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                                                           NaN   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                                                           NaN   

                                                                                                                logLossVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'logLossCls': [1.72596805748, 1.7853875361, ...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             {u'logLossCls': [1.7477126908, 1.45845704706, ...   
                                                    2.0       1             {u'logLossCls': [2.4098162987, 2.1249522721, 2...   
                                 0.0       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              2             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              1             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              10            {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                 0.1       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                           4.0      1.0       1             {u'logLossCls': [1.47759900586, 1.5216033003, ...   
                                           8.0      2.0       2             {u'logLossCls': [2.96027056113, 1.55809628297,...   
                                                              4             {u'logLossCls': [2.1684078246, 2.40346788464, ...   
                                           16.0     4.0       10            {u'logLossCls': [1.79621628564, 1.99717570497,...   
                                 0.0       8.0      7.0       10            {u'logLossCls': [2.16842694926, 2.08737047825,...   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                                              1             {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                           8.0      5.0       10            {u'logLossCls': [2.49658612049, 3.01094383144,...   
                                 0.5       8.0      4.0       10            {u'logLossCls': [2.1293109356, 1.52307431523, ...   
                                           16.0     4.0       10            {u'logLossCls': [2.13819531033, 3.35150390363,...   
                                 0.0       8.0      1.0       0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              1             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              2             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                              10            {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                 0.1       8.0      1.0       0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                 0.0       32.0     1.0       10            {u'logLossCls': [1.3367673536, 2.19949472069, ...   
                                 0.1       8.0      2.0       5             {u'logLossCls': [2.47060812006, 2.55482495458,...   
                                 0.0       8.0      0.5       10            {u'logLossCls': [1.73155548863, 2.32786043541,...   
...                                                                                                                       ...   
                                 0.1       4.0      3.0       1             {u'logLossCls': [1.71708309944, 3.4968377777, ...   
                                           16.0     3.0       10            {u'logLossCls': [1.71310413171, 3.4687167196, ...   
                                 0.0       16.0     2.0       2             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              10            {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              1             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              0             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   18077.0 0.5       4.0      3.0       10            {u'logLossCls': [2.62356084168, 3.42588099594,...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'logLossCls': [1.84540699409, 1.93896956479,...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             {u'logLossCls': [1.14059053163, 1.46723165909,...   
                                                    0.1       0             {u'logLossCls': [1.11536194976, 1.25718941188,...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   9000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
                         8000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.5257602538, 1.31972597838, ...   
                         7000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.06754908637, 1.51088086827,...   
                         6000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.97387028973, 1.20522205183,...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.57533202071, 1.59023941247,...   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                                                           NaN   
                         1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             {u'logLossCls': [1.28781316316, 3.51519487621,...   
                                                    1.0       0             {u'logLossCls': [0.842354858019, 1.17531354279...   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.84808429073, 3.58756550329,...   
                100.0    1000.0  0.1       16.0     1.0       10            {u'logLossCls': [2.1826821181, 3.34540505739, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'logLossCls': [1.47411393905, 2.08387227918,...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'logLossCls': [3.67759601248, 3.22267129616,...   

                                                                              accVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             1.000000   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             0.987348   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             0.375201   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             0.361859   
                                                    2.0       1             0.357488   
                                 0.0       8.0      3.0       0             0.357028   
                                                              2             0.357028   
                                                              1             0.357028   
                                                              10            0.357028   
                                 0.1       8.0      3.0       0             0.357028   
                                           4.0      1.0       1             0.355648   
                                           8.0      2.0       2             0.351737   
                                                              4             0.348516   
                                           16.0     4.0       10            0.346216   
                                 0.0       8.0      7.0       10            0.346216   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0             0.343685   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            0.338854   
                                                              1             0.338854   
                                           8.0      5.0       10            0.336784   
                                 0.5       8.0      4.0       10            0.334484   
                                           16.0     4.0       10            0.331723   
                                 0.0       8.0      1.0       0             0.331493   
                                                              1             0.331493   
                                                              2             0.331493   
                                                              10            0.331493   
                                 0.1       8.0      1.0       0             0.331493   
                                 0.0       32.0     1.0       10            0.328042   
                                 0.1       8.0      2.0       5             0.325512   
                                 0.0       8.0      0.5       10            0.325052   
...                                                                              ...   
                                 0.1       4.0      3.0       1             0.226823   
                                           16.0     3.0       10            0.219692   
                                 0.0       16.0     2.0       2             0.214861   
                                                              10            0.214861   
                                                              1             0.214861   
                                                              0             0.214861   
                100.0    18077.0 0.1       16.0     1.0       10            0.210950   
                1000.0   18077.0 0.5       4.0      3.0       10            0.208420   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             0.342535   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             0.384173   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             0.358638   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0             0.319991   
                                                    0.1       0             0.251208   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            0.210950   
                1000.0   9000.0  0.1       8.0      3.0       2             0.381643   
                         8000.0  0.1       8.0      3.0       2             0.378882   
                         7000.0  0.1       8.0      3.0       2             0.375431   
                         6000.0  0.1       8.0      3.0       2             0.339545   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             0.363699   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             0.320911   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0             0.341385   
                         1000.0  0.0       1000.0  -1.0       0             0.333333   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0             0.273522   
                                                    1.0       0             0.255809   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             0.224983   
                100.0    1000.0  0.1       16.0     1.0       10            0.212790   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             0.173453   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             0.307108   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             0.224753   

                                                                            duration  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                  874   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                  743   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                   11   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                  519   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2                    9   
                                                    2.0       1                   10   
                                 0.0       8.0      3.0       0                    8   
                                                              2                    8   
                                                              1                    9   
                                                              10                  10   
                                 0.1       8.0      3.0       0                   10   
                                           4.0      1.0       1                    8   
                                           8.0      2.0       2                   10   
                                                              4                   13   
                                           16.0     4.0       10                  14   
                                 0.0       8.0      7.0       10                   9   
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                  597   
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10                   8   
                                                              1                    8   
                                           8.0      5.0       10                   9   
                                 0.5       8.0      4.0       10                  15   
                                           16.0     4.0       10                  24   
                                 0.0       8.0      1.0       0                    8   
                                                              1                    8   
                                                              2                    8   
                                                              10                   9   
                                 0.1       8.0      1.0       0                   13   
                                 0.0       32.0     1.0       10                  16   
                                 0.1       8.0      2.0       5                   10   
                                 0.0       8.0      0.5       10                   9   
...                                                                              ...   
                                 0.1       4.0      3.0       1                    9   
                                           16.0     3.0       10                  13   
                                 0.0       16.0     2.0       2                   10   
                                                              10                  11   
                                                              1                   11   
                                                              0                   11   
                100.0    18077.0 0.1       16.0     1.0       10                   2   
                1000.0   18077.0 0.5       4.0      3.0       10                  12   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                  514   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                  288   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                  317   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                  301   
                                                    0.1       0                  295   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                   2   
                1000.0   9000.0  0.1       8.0      3.0       2                    9   
                         8000.0  0.1       8.0      3.0       2                    9   
                         7000.0  0.1       8.0      3.0       2                    9   
                         6000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                  150   
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                   55   
                         1000.0  0.0       1000.0  -1.0       0                   28   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                    7   
                                                    1.0       0                    5   
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2                    9   
                100.0    1000.0  0.1       16.0     1.0       10                   2   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                    5   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                    8   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                    9   

                                                                                        id  
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                  
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                 LgtRgr.skl  
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                 LgtRgr.tfw  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                 LgtRgr.tfw  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      1.0       2             LgtRgr.SGD.tfw  
                                                    2.0       1             LgtRgr.SGD.tfw  
                                 0.0       8.0      3.0       0             LgtRgr.SGD.tfw  
                                                              2             LgtRgr.SGD.tfw  
                                                              1             LgtRgr.SGD.tfw  
                                                              10            LgtRgr.SGD.tfw  
                                 0.1       8.0      3.0       0             LgtRgr.SGD.tfw  
                                           4.0      1.0       1             LgtRgr.SGD.tfw  
                                           8.0      2.0       2             LgtRgr.SGD.tfw  
                                                              4             LgtRgr.SGD.tfw  
                                           16.0     4.0       10            LgtRgr.SGD.tfw  
                                 0.0       8.0      7.0       10            LgtRgr.SGD.tfw  
LgtRgr.skl     -1.0      18077.0 0.0       18077.0 -1.0       0                 LgtRgr.skl  
LgtRgr.SGD.tfw  1000.0   18077.0 0.0       4.0      4.0       10            LgtRgr.SGD.tfw  
                                                              1             LgtRgr.SGD.tfw  
                                           8.0      5.0       10            LgtRgr.SGD.tfw  
                                 0.5       8.0      4.0       10            LgtRgr.SGD.tfw  
                                           16.0     4.0       10            LgtRgr.SGD.tfw  
                                 0.0       8.0      1.0       0             LgtRgr.SGD.tfw  
                                                              1             LgtRgr.SGD.tfw  
                                                              2             LgtRgr.SGD.tfw  
                                                              10            LgtRgr.SGD.tfw  
                                 0.1       8.0      1.0       0             LgtRgr.SGD.tfw  
                                 0.0       32.0     1.0       10            LgtRgr.SGD.tfw  
                                 0.1       8.0      2.0       5             LgtRgr.SGD.tfw  
                                 0.0       8.0      0.5       10            LgtRgr.SGD.tfw  
...                                                                                    ...  
                                 0.1       4.0      3.0       1             LgtRgr.SGD.tfw  
                                           16.0     3.0       10            LgtRgr.SGD.tfw  
                                 0.0       16.0     2.0       2             LgtRgr.SGD.tfw  
                                                              10            LgtRgr.SGD.tfw  
                                                              1             LgtRgr.SGD.tfw  
                                                              0             LgtRgr.SGD.tfw  
                100.0    18077.0 0.1       16.0     1.0       10            LgtRgr.SGD.tfw  
                1000.0   18077.0 0.5       4.0      3.0       10            LgtRgr.SGD.tfw  
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                 LgtRgr.skl  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                 LgtRgr.tfw  
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                 LgtRgr.skl  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  1.0       0                 LgtRgr.tfw  
                                                    0.1       0                 LgtRgr.tfw  
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            LgtRgr.SGD.tfw  
                1000.0   9000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
                         8000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
                         7000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
                         6000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                 LgtRgr.skl  
LgtRgr.SGD.tfw  1000.0   5000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
LgtRgr.skl     -1.0      2000.0  0.0       2000.0  -1.0       0                 LgtRgr.skl  
                         1000.0  0.0       1000.0  -1.0       0                 LgtRgr.skl  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   10.0      0                 LgtRgr.tfw  
                                                    1.0       0                 LgtRgr.tfw  
LgtRgr.SGD.tfw  1000.0   1000.0  0.1       8.0      3.0       2             LgtRgr.SGD.tfw  
                100.0    1000.0  0.1       16.0     1.0       10            LgtRgr.SGD.tfw  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                 LgtRgr.tfw  
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                 LgtRgr.skl  
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             LgtRgr.SGD.tfw  

[120 rows x 8 columns]
/usr/local/lib/python2.7/site-packages/ipykernel/kernelbase.py:212: PerformanceWarning: indexing past lexsort depth may impact performance.
  handler(stream, idents, msg)
In [4]:
# # With gradient descent training, even this much data is prohibitive.
# # Subset the training data for faster turnaround.
# nObsFit = 10000

# graph = tf.Graph()
# with graph.as_default():

#   # Input data.
#   # Load the training, validation and test data into constants that are
#   # attached to the graph.
#   tfwObsFitFtr = tf.constant(glbXFit[:nObsFit, :])
#   tfwObsFitRsp = tf.constant(glbYFit[:nObsFit])
#   tfwObsVldFtr = tf.constant(glbXVld)
#   tfwObsNewFtr = tf.constant(glbXNew)
  
#   # Variables.
#   # These are the parameters that we are going to be training. The weight
#   # matrix will be initialized using random valued following a (truncated)
#   # normal distribution. The tfwB get initialized to zero.
#   tfwW = tf.Variable(
#     tf.truncated_normal([glbImg['size'] * glbImg['size'], glbRspClassN]), name = 'tfwW')
#   tfwB = tf.Variable(tf.zeros([glbRspClassN]), name = 'tfwB')
#   print(tfwW.initialized_value())
#   print(tfwB.initialized_value())
# #   print 'initial  tfwB:%s' % (np.vectorize("%.4e".__mod__)(tf.get_variable('tfwB')))
# #   print 'initial tfwW (first 5 only):' 
# #   for lblIx in xrange(glbRspClassN):
# #     print 'lblIx:%2d:%s'% (np.vectorize("%.4e".__mod__)(tfwW.value()[:5, lblIx]))
  
#   # Training computation.
#   # We multiply the inputs with the weight matrix, and add tfwB. We compute
#   # the softmax and cross-entropy (it's one operation in TensorFlow, because
#   # it's very common, and it can be optimized). We take the average of this
#   # cross-entropy across all training examples: that's our loss.
#   logits = tf.matmul(tfwObsFitFtr, tfwW) + tfwB
#   loss = tf.reduce_mean(
#     tf.nn.softmax_cross_entropy_with_logits(logits, tfwObsFitRsp))
  
#   # Optimizer.
#   # We are going to find the minimum of this loss using gradient descent.
#   optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)
  
#   # Predictions for the training, validation, and test data.
#   # These are not part of training, but merely here so that we can report
#   # accuracy_score figures as we train.
#   tfwObsTrnPred = tf.nn.softmax(logits)
#   tfwObsVldPred = tf.nn.softmax(
#     tf.matmul(tfwObsVldFtr, tfwW) + tfwB)
#   tfwObsNewPred = tf.nn.softmax(tf.matmul(tfwObsNewFtr, tfwW) + tfwB)
Tensor("Identity:0", shape=TensorShape([Dimension(784), Dimension(10)]), dtype=float32)
Tensor("Identity_1:0", shape=TensorShape([Dimension(10)]), dtype=float32)

Let's run this computation and iterate:

In [58]:
# nStepsTfw = 801

# def accuracy_score(predictions, labels):
#   return (100.0 * np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1))
#           / predictions.shape[0])

# with tf.Session(graph=graph) as session:
#   # This is a one-time operation which ensures the parameters get initialized as
#   # we described in the graph: random tfwW for the matrix, zeros for the
#   # tfwB. 
#   tf.initialize_all_variables().run()
#   print('Initialized')
#   for step in range(nStepsTfw):
#     # Run the computations. We tell .run() that we want to run the optimizer,
#     # and get the loss value and the training predictions returned as numpy
#     # arrays.
#     _, l, predictions = session.run([optimizer, loss, tfwObsTrnPred])
#     if (step % 100 == 0):
#       print('Loss at step %d: %f' % (step, l))
#       print('Training accuracy_score: %.1f%%' % accuracy_score(
#         predictions, glbYFit[:nObsFit, :]))
#       # Calling .eval() on tfwObsVldPred is basically like calling run(), but
#       # just to get that one numpy array. Note that it recomputes all its graph
#       # dependencies.
#       print('Validation accuracy_score: %.1f%%' % accuracy_score(
#         tfwObsVldPred.eval(), glbYVld))
#   print('Test accuracy_score: %.1f%%' % accuracy_score(tfwObsNewPred.eval(), glbYNew))
In [13]:
robjects.pandas2ri.activate()
pltRDf = robjects.conversion.py2ri(glbMdlDf)
# print(pltRDf)
pltRFn = robjects.r("""
    source('~/Dropbox/datascience/R/myplot.R')
    function(RDf, filename) {
        mypltModelStats(RDf, c('accVld', 'logLossVld', 'duration'), 
            dim = c('nObsFit', 'id', 'nStepsTfw', 'lrnRateTfw'), 
                scaleXFn = NULL, 
                #highLightIx = which.min(RDf$logLossVld),
                highLightIx = which(RDf$bestFit == 'TRUE'),                
            title = NULL, 
            fileName = filename)
    }                        
""")    
pltRFn(pltRDf, 'img_04_fit_lgtRgr_SGD_Tfw_SFDD_glbMdlDf.png')

pltRFn = robjects.r("""
    source('~/Dropbox/datascience/R/myplot.R')
    function(RDf, filename) {
        mypltModelStats(RDf, c('accVld', 'logLossVld'), 
            dim = c('nObsFit', 'id', 'nStepsTfw', 'lrnRateTfw'), 
                scaleXFn = NULL, 
                #highLightIx = which.min(RDf$logLossVld),
                highLightIx = which(RDf$bestFit == 'TRUE'),                
            title = NULL, 
            fileName = filename)
    }                        
""")    
pltRFn(pltRDf, 'img_04_fit_lgtRgr_SGD_Tfw_SFDD_glbMdlDf_logLossVld.png')

pltRFn = robjects.r("""
    source('~/Dropbox/datascience/R/myplot.R')
    function(RDf, filename) {
        mypltModelStats(RDf, c('accVld'), 
            dim = c('nObsFit', 'id', 
                    'nObsBtc', 'rotatePby', 'rotateMaxAgl',
                    'nStepsTfw', 'lrnRateTfw'), 
                scaleXFn = NULL, 
                #highLightIx = which.min(RDf$logLossVld),
                highLightIx = which(RDf$bestFit == 'TRUE'),                
            title = NULL, 
            fileName = filename)
    }                        
""")    
pltRFn(pltRDf, 'img_04_fit_lgtRgr_SGD_Tfw_SFDD_glbMdlDf_accVld.png')

pltRFn = robjects.r("""
    source('~/Dropbox/datascience/R/myplot.R')
    function(RDf, filename) {
        mypltModelStats(subset(RDf, 
                            # nObsBtc      %in% c(8, 18077, 22424) &
                                lrnRateTfw   %in% c(-1.0, 3.0, 10.0) &
                                rotatePby    %in% c(0.0, 0.1) &
                                rotateMaxAgl %in% c(0, 2)
                            ),
                measure = c('accVld'),
                dim = c('nObsFit', 'id',
                        # 'nObsBtc',
                        # 'lrnRateTfw',
                        # 'rotatePby',
                        'rotateMaxAgl',
                        'nStepsTfw',
                        NULL),        
                scaleXFn = NULL, 
                #highLightIx = which.min(RDf$logLossVld),
                highLightIx = which(RDf$bestFit == 'TRUE'),                
            title = NULL, 
            fileName = filename)
    }                        
""")    
pltRFn(pltRDf, 'img_04_fit_lgtRgr_SGD_Tfw_SFDD_glbMdlDf_accVldSel.png')

# id nStepsTfw  nObsFit  rotatePby  nObsBtc  lrnRateTfw  rotateMaxAgl
/usr/local/lib/python2.7/site-packages/rpy2/robjects/functions.py:106: UserWarning: geom_path: Each group consists of only one observation. Do you need to adjust
the group aesthetic?

  res = super(Function, self).__call__(*new_args, **new_kwargs)
Out[13]:
<ListVector - Python:0x13c88f320 / R:0x7fe0225c8bf8>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
<ListVector - Python:0x13c88f320 / R:0x7fe0225c8bf8>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
<ListVector - Python:0x13c88f320 / R:0x7fe0225c8bf8>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
  scales: <class 'rpy2.robjects.environments.Environment'>
  <Environment - Python:0x13c869710 / R:0x7fe00b93f778>
  ...
<ListVector - Python:0x13c88f320 / R:0x7fe0225c8bf8>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
  layers: <class 'rpy2.robjects.environments.Environment'>
  <Environment - Python:0x13c88f098 / R:0x7fe00c39dc08>
<ListVector - Python:0x13c88f320 / R:0x7fe0225c8bf8>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
In [29]:
glbMdlDf.to_csv('img_04_fit_lgtRgr_SGD_Tfw_SFDD_glbMdlDf.csv')

Fit selected model to glbObsFit

In [14]:
selMdlSrs = glbMdlDf[glbMdlDf['bestFit']]
print selMdlSrs
                                                                              accVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2             0.381643   

                                                                                                                    accVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2             {u'accCls': [0.607438016529, 0.219665271967, 0...   

                                                                           bestFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2               True   

                                                                            duration  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                   11   

                                                                                        id  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                   
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2             LgtRgr.SGD.tfw   

                                                                            logLossVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2              20.546733   

                                                                                                                logLossVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2             {u'logLossCls': [1.48863261945, 2.76463156066,...   

                                                                            lrnRateTfw  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                    3.0   

                                                                            nObsBtc  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                 8.0   

                                                                            nObsFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2             18077.0   

                                                                            nStepsTfw  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl              
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                1000.0   

                                                                           predNew  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                NaN   

                                                                           rotateMaxAgl  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                       2   

                                                                           rotatePby  
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.SGD.tfw 1000.0    18077.0 0.1       8.0     3.0        2                  0.1  
In [15]:
selMdlDf, selYVldPby, selYNewPby = fitMdlLgtRgrSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = glbXFit.shape[0], 
    nObsBtc = selMdlSrs['nObsBtc'][0],     
    rotatePby = selMdlSrs['rotatePby'][0],     
    rotateMaxAgl = selMdlSrs['rotateMaxAgl'][0],         
    nStepsTfw = selMdlSrs['nStepsTfw'][0], 
    lrnRateTfw = selMdlSrs['lrnRateTfw'][0], 
    visualize = True, newObs = True, verbose = True)
# def fitMdlLgtRgrSGDTfw(lclXFit, lclYFit, 
#             nObsFit = 100, nObsBtc = 16, 
#             rotatePby = 0.1, rotateMaxAgl = 5,
#             nStepsTfw = 10, lrnRateTfw = 0.1,
#                     visualize = False, newObs = False, verbose = False):
Logistic Regression (TensorFlow): nObsFit:18077; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nStepsTfw: 1000; lrnRateTfw:3.0000 
  visualize: True; newObs: True; verbose: True
('  tfwW:', <tf.Tensor 'Identity:0' shape=(4096, 10) dtype=float32>)
('  tfwB:', <tf.Tensor 'Identity_1:0' shape=(10,) dtype=float32>)
  Initialized
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:124: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:143: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:126: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/numpy/core/fromnumeric.py:225: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return reshape(newshape, order=order)
  step     1(    0 secs): Minibatch rotation:angle: 0.7815
  step     6(    0 secs): Minibatch rotation:angle: 1.3900
  step    13(    0 secs): Minibatch rotation:angle: 1.4487
  step    34(    0 secs): Minibatch rotation:angle: 0.2647
  step    39(    0 secs): Minibatch rotation:angle: -0.4238
  step    40(    0 secs): Minibatch rotation:angle: -1.0228
  step    42(    1 secs): Minibatch rotation:angle: -1.5997
  step    73(    1 secs): Minibatch rotation:angle: -1.4536
  step    75(    1 secs): Minibatch rotation:angle: 0.7455
  step    78(    1 secs): Minibatch rotation:angle: -0.2561
  step    86(    1 secs): Minibatch rotation:angle: 0.0559
  step    89(    1 secs): Minibatch rotation:angle: 0.8329
  step    93(    1 secs): Minibatch rotation:angle: 0.1879
  step   101(    1 secs): Minibatch rotation:angle: 0.1547
  step   123(    1 secs): Minibatch rotation:angle: 0.4447
  step   134(    1 secs): Minibatch rotation:angle: -1.7246
  step   139(    1 secs): Minibatch rotation:angle: -0.6370
  step   148(    1 secs): Minibatch rotation:angle: -0.7290
  step   149(    1 secs): Minibatch rotation:angle: 0.6298
  step   168(    1 secs): Minibatch rotation:angle: 0.9559
  step   174(    1 secs): Minibatch rotation:angle: 1.4031
  step   177(    1 secs): Minibatch rotation:angle: 1.5177
  step   193(    1 secs): Minibatch rotation:angle: -1.5264
  step   208(    2 secs): Minibatch rotation:angle: 0.8651
  step   219(    2 secs): Minibatch rotation:angle: -0.7559
  step   227(    2 secs): Minibatch rotation:angle: -0.7687
  step   228(    2 secs): Minibatch rotation:angle: 0.7853
  step   229(    2 secs): Minibatch rotation:angle: 0.7060
  step   259(    2 secs): Minibatch rotation:angle: 1.1189
  step   262(    2 secs): Minibatch rotation:angle: 1.2409
  step   284(    2 secs): Minibatch rotation:angle: 1.2055
  step   302(    2 secs): Minibatch rotation:angle: -0.8014
  step   307(    2 secs): Minibatch rotation:angle: 1.5852
  step   320(    2 secs): Minibatch rotation:angle: -1.7845
  step   323(    2 secs): Minibatch rotation:angle: 0.6667
  step   355(    2 secs): Minibatch rotation:angle: -0.7972
  step   356(    2 secs): Minibatch rotation:angle: -1.0431
  step   380(    2 secs): Minibatch rotation:angle: 0.8782
  step   401(    4 secs): Minibatch rotation:angle: 1.0272
  step   406(    4 secs): Minibatch rotation:angle: 1.2680
  step   412(    4 secs): Minibatch rotation:angle: -0.3036
  step   427(    4 secs): Minibatch rotation:angle: 0.6773
  step   456(    4 secs): Minibatch rotation:angle: -0.2512
  step   457(    4 secs): Minibatch rotation:angle: 1.2892
  step   462(    4 secs): Minibatch rotation:angle: -1.4782
  step   520(    4 secs): Minibatch rotation:angle: 0.1854
  step   524(    4 secs): Minibatch rotation:angle: -0.2769
  step   544(    4 secs): Minibatch rotation:angle: -0.3829
  step   552(    4 secs): Minibatch rotation:angle: -0.8067
  step   555(    4 secs): Minibatch rotation:angle: -1.0371
  step   565(    4 secs): Minibatch rotation:angle: -0.0422
  step   581(    4 secs): Minibatch rotation:angle: -1.8645
  step   583(    4 secs): Minibatch rotation:angle: -0.3721
  step   587(    4 secs): Minibatch rotation:angle: -0.6783
  step   633(    6 secs): Minibatch rotation:angle: 0.2982
  step   644(    6 secs): Minibatch rotation:angle: -0.1618
  step   657(    6 secs): Minibatch rotation:angle: -0.7546
  step   658(    6 secs): Minibatch rotation:angle: 0.1138
  step   681(    6 secs): Minibatch rotation:angle: -1.7727
  step   682(    6 secs): Minibatch rotation:angle: 0.7245
  step   687(    6 secs): Minibatch rotation:angle: 1.4412
  step   689(    6 secs): Minibatch rotation:angle: -0.5182
  step   691(    6 secs): Minibatch rotation:angle: 0.6104
  step   700(    6 secs): Minibatch rotation:angle: 0.2777
  step   713(    6 secs): Minibatch rotation:angle: 0.4088
  step   731(    6 secs): Minibatch rotation:angle: 1.5995
  step   761(    6 secs): Minibatch rotation:angle: -0.1049
  step   764(    6 secs): Minibatch rotation:angle: -0.1286
  step   785(    6 secs): Minibatch rotation:angle: 0.2296
  step   795(    6 secs): Minibatch rotation:angle: -1.4570
  step   813(    7 secs): Minibatch rotation:angle: -1.5104
  step   837(    7 secs): Minibatch rotation:angle: 0.9490
  step   847(    7 secs): Minibatch rotation:angle: 1.2389
  step   857(    7 secs): Minibatch rotation:angle: 1.9708
  step   861(    7 secs): Minibatch rotation:angle: -1.3822
  step   877(    7 secs): Minibatch rotation:angle: -1.6069
  step   880(    7 secs): Minibatch rotation:angle: 1.4276
  step   882(    7 secs): Minibatch rotation:angle: 0.0323
  step   895(    7 secs): Minibatch rotation:angle: -0.7840
  step   909(    7 secs): Minibatch rotation:angle: 0.2200
  step   924(    7 secs): Minibatch rotation:angle: 0.9365
  step   939(    7 secs): Minibatch rotation:angle: 0.5616
  step   942(    7 secs): Minibatch rotation:angle: -1.3131
  step   945(    7 secs): Minibatch rotation:angle: 0.5496
  step   948(    7 secs): Minibatch rotation:angle: 1.8078
  step   952(    7 secs): Minibatch rotation:angle: 1.6791
  step   954(    7 secs): Minibatch rotation:angle: 1.3377
  step   969(    7 secs): Minibatch rotation:angle: 0.3555
  step   981(    7 secs): Minibatch rotation:angle: -0.8890
  step   992(    7 secs): Minibatch rotation:angle: -0.7087

  Vld accuracy:0.3816
[ 0.6074  0.2197  0.5951  0.5643  0.1939  0.1896  0.456   0.6771  0.1841
  0.146 ]
[[294   9  75   9  64   0  14  19   0   0]
 [  3 105 103   1   0   0   7 243   1  15]
 [  0   1 269  11   0   0  99  65   7   0]
 [ 21   0  79 250  58  25   0   2   2   6]
 [ 63   1  83 157  89  19   3   9  13  22]
 [ 73  14  14  44  13  80 133  27  24   0]
 [  2   9 109  72   1   0 202  36  12   0]
 [  0   4  49  16   0   2  34 237   8   0]
 [ 14   2  97  18   3   5  68  89  67   1]
 [ 11   0 181 115  52   5   1  20   1  66]]
  Vld  logLoss:20.5467
[ 1.4886  2.7646  1.3374  1.4457  2.908   2.6567  1.7421  0.815   2.3394
  3.0493]


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 421
  img_62023.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.6046; nObs: 1
  img_3899.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.6046  0.      0.      0.      0.3954  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 115
  img_53130.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.6158; nObs: 1
  img_100358.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.6158  0.3842  0.      0.      0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - right


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 928
  img_24934.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.5197; nObs: 1
  img_52596.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.5197  0.      0.      0.      0.4803  0.      0.      0.    ]
  next best class: drinking


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 621
  img_79904.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.5347; nObs: 1
  img_42027.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.5347  0.      0.      0.4653  0.      0.      0.    ]
  next best class: drinking


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 261
  img_18343.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.7097; nObs: 1
  img_27020.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.7097  0.      0.      0.2903  0.      0.    ]
  next best class: reaching behind


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 113
  img_15928.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.5496; nObs: 1
  img_13512.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.4504  0.      0.5496  0.      0.      0.      0.    ]
  next best class: texting - left


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 480
  img_29251.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.5265; nObs: 1
  img_43784.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.      0.4735  0.5265  0.      0.      0.    ]
  next best class: operating the radio


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 644
  img_80068.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.5231; nObs: 1
  img_30223.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.4769  0.      0.      0.      0.      0.5231  0.      0.    ]
  next best class: talking on the phone - right


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 114
  img_31586.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.5134; nObs: 1
  img_63085.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.4866  0.      0.      0.      0.      0.      0.5134
  0.    ]
  next best class: talking on the phone - right


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 91
  img_25562.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.5606; nObs: 1
  img_61126.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.4394  0.      0.      0.      0.      0.      0.      0.      0.
  0.5606]
  next best class: normal driving
  predicting 79726 new obs...


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 9879
  img_100.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.4028; nObs: 1
  img_19394.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.4028  0.      0.      0.367   0.      0.      0.      0.      0.
  0.2302]
  next best class: texting - left


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 2864
  img_100030.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.5020; nObs: 1
  img_47748.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.     0.502  0.     0.498  0.     0.     0.     0.     0.     0.   ]
  next best class: texting - left


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 11332
  img_1.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.5030; nObs: 1
  img_8923.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.     0.     0.503  0.     0.     0.     0.     0.497  0.     0.   ]
  next best class: reaching behind


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 5611
  img_10.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.4147; nObs: 1
  img_10687.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.2919  0.      0.      0.4147  0.      0.      0.      0.2934  0.      0.    ]
  next best class: reaching behind


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 2413
  img_100016.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.4235; nObs: 1
  img_73467.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.2586  0.4235  0.      0.      0.3179  0.      0.    ]
  next best class: reaching behind


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 4406
  img_100023.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.5054; nObs: 1
  img_38145.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.4946  0.      0.      0.      0.      0.5054  0.      0.      0.      0.    ]
  next best class: normal driving


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 5603
  img_100004.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.5026; nObs: 1
  img_92615.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.5026  0.      0.4974
  0.    ]
  next best class: hair and makeup


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 12661
  img_100005.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.4289; nObs: 1
  img_32173.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.2325  0.      0.      0.      0.3386  0.4289  0.      0.    ]
  next best class: drinking


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 5467
  img_100007.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.4734; nObs: 1
  img_97640.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.1803  0.      0.      0.      0.      0.3463  0.      0.4734
  0.    ]
  next best class: drinking


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 6562
  img_100028.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.4141; nObs: 1
  img_9380.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.2825  0.3034  0.      0.      0.      0.      0.      0.      0.
  0.4141]
  next best class: texting - right

  New prediction knts:
{'kntCls': (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([11609,  3451, 13417,  6688,  3000,  4989,  6714, 14866,  6579,  8413]))}
  duration: 107 seconds
In [16]:
print '\n selMdl:'
glbwriteSubmission(glbINew, selYNewPby, 
    'img_04_fit_lgtRgr_SGD_Tfw_SFDD_ImgSz_' + str(glbImg['size']) + \
                   '_sbmt_sel.csv')
 selMdl:
                           img            c0   c1   c2   c3            c4  \
img                                                                         
img_1.jpg            img_1.jpg  6.764812e-32  0.0  1.0  0.0  3.422848e-29   
img_10.jpg          img_10.jpg  0.000000e+00  0.0  0.0  1.0  0.000000e+00   
img_100.jpg        img_100.jpg  1.000000e+00  0.0  0.0  0.0  0.000000e+00   
img_1000.jpg      img_1000.jpg  2.215907e-07  0.0  0.0  0.0  8.074588e-30   
img_100000.jpg  img_100000.jpg  0.000000e+00  0.0  0.0  1.0  9.966320e-19   

                          c5            c6            c7   c8   c9  
img                                                                 
img_1.jpg       0.000000e+00  0.000000e+00  3.077862e-11  0.0  0.0  
img_10.jpg      8.291059e-29  0.000000e+00  0.000000e+00  0.0  0.0  
img_100.jpg     0.000000e+00  0.000000e+00  0.000000e+00  0.0  0.0  
img_1000.jpg    0.000000e+00  5.287736e-14  0.000000e+00  0.0  1.0  
img_100000.jpg  0.000000e+00  0.000000e+00  0.000000e+00  0.0  0.0  
                         img        c0        c1            c2            c3  \
img                                                                            
img_99994.jpg  img_99994.jpg  0.980845  0.019155  0.000000e+00  0.000000e+00   
img_99995.jpg  img_99995.jpg  0.000000  0.000000  3.444694e-31  0.000000e+00   
img_99996.jpg  img_99996.jpg  0.000000  0.000000  4.330597e-16  1.721270e-19   
img_99998.jpg  img_99998.jpg  0.000000  0.000000  1.061564e-27  0.000000e+00   
img_99999.jpg  img_99999.jpg  0.000000  0.000000  0.000000e+00  0.000000e+00   

                c4            c5            c6            c7   c8  \
img                                                                 
img_99994.jpg  0.0  3.311643e-38  0.000000e+00  1.641042e-21  0.0   
img_99995.jpg  0.0  0.000000e+00  9.911789e-21  0.000000e+00  0.0   
img_99996.jpg  1.0  0.000000e+00  0.000000e+00  0.000000e+00  0.0   
img_99998.jpg  0.0  0.000000e+00  1.000000e+00  1.118691e-16  0.0   
img_99999.jpg  0.0  0.000000e+00  1.000000e+00  0.000000e+00  0.0   

                         c9  
img                          
img_99994.jpg  5.080267e-27  
img_99995.jpg  1.000000e+00  
img_99996.jpg  0.000000e+00  
img_99998.jpg  0.000000e+00  
img_99999.jpg  0.000000e+00  

exporting 79726 rows to img_04_fit_lgtRgr_SGD_Tfw_SFDD_ImgSz_64_sbmt_sel.csv...

Fit selected model to glbObsTrn

In [16]:
finMdlDf, finYVldPby, finYNewPby = fitMdlLgtRgrTfw(
    glbXTrn, glbYTrn, 
    nObsFit = glbXTrn.shape[0], 
    nStepsTfw = selMdlSrs['nStepsTfw'][0], 
    lrnRateTfw = selMdlSrs['lrnRateTfw'][0], 
    visualize = True, newObs = True, verbose = True)

# finMdlDf, glbYNewPredProba = fitMdlLgtRgrTfw(glbXTrn, glbYTrn, 
#                         nObsFit = glbXTrn.shape[0], 
#                         nStepsTfw = selMdlSrs['nStepsTfw'][0], 
#                      verbose = True)
Logistic Regression (TensorFlow): nObsFit:22424; nStepsTfw: 1000; lrnRateTfw:10.0000
  visualize: True; newObs: True; verbose: True
('  tfwW:', <tf.Tensor 'Identity:0' shape=(4096, 10) dtype=float32>)
('  tfwB:', <tf.Tensor 'Identity_1:0' shape=(10,) dtype=float32>)
  Initialized
  logLoss at step   200: 80.1486 (132 secs)
  logLoss at step   400: 1.7235 (256 secs)
  logLoss at step   600: 0.8414 (383 secs)
  logLoss at step   800: 0.4962 (511 secs)

  Fit accuracy:0.9860
  Fit  logLoss:0.1987

  Vld accuracy:0.9873
[ 0.9897  0.9916  0.9934  0.9955  0.9869  0.9787  0.9819  0.9886  0.978
  0.9867]
[[479   0   1   1   1   0   1   0   1   0]
 [  0 474   0   0   0   0   0   0   4   0]
 [  0   1 449   0   0   0   0   0   2   0]
 [  0   0   1 441   0   1   0   0   0   0]
 [  1   0   1   1 453   1   0   0   2   0]
 [  3   0   3   0   2 413   0   0   1   0]
 [  1   2   0   0   1   0 435   0   4   0]
 [  0   0   1   0   0   0   3 346   0   0]
 [  1   1   1   1   0   0   0   1 356   3]
 [  1   0   0   1   1   1   0   1   1 446]]
  Vld  logLoss:0.1931
[ 0.0123  0.0242  0.0177  0.006   0.0157  0.0469  0.0126  0.0176  0.0281
  0.012 ]


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 456
  img_62023.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.5354; nObs: 1
  img_18149.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.5354  0.      0.      0.      0.      0.      0.      0.      0.4646
  0.    ]
  next best class: hair and makeup


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 467
  img_89322.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.7596; nObs: 1
  img_73652.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.7596  0.      0.      0.      0.      0.2404  0.      0.      0.    ]
  next best class: drinking


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 436
  img_29251.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.5330; nObs: 1
  img_4967.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.533   0.      0.4669  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 420
  img_77361.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.6106; nObs: 1
  img_39039.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.6106  0.      0.      0.      0.      0.3891
  0.0003]
  next best class: hair and makeup


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 437
  img_79904.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.7069; nObs: 1
  img_61406.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.0847  0.7069  0.      0.      0.2084  0.      0.    ]
  next best class: reaching behind


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 400
  img_70461.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.5448; nObs: 1
  img_94334.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.      0.5448  0.4327  0.0225  0.      0.    ]
  next best class: drinking


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 414
  img_68722.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.6801; nObs: 1
  img_25077.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.3199  0.      0.6801  0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 340
  img_94744.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.7922; nObs: 1
  img_31899.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.      0.7922  0.2078
  0.    ]
  next best class: hair and makeup


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 341
  img_78749.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.6049; nObs: 1
  img_41698.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.0236  0.      0.0025  0.      0.      0.      0.6049
  0.3689]
  next best class: talking to passenger


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 431
  img_24934.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.5018; nObs: 1
  img_56078.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.4982  0.      0.      0.      0.      0.
  0.5018]
  next best class: texting - left
  predicting 79726 new obs...
    @  685 secs: obsIx:     0
    @  686 secs: obsIx:  8000
    @  692 secs: obsIx: 40000


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 4198
  img_100.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.4145; nObs: 1
  img_43032.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.4145  0.      0.      0.      0.0101  0.2402  0.      0.      0.
  0.3352]
  next best class: talking to passenger


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 6052
  img_100003.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.4720; nObs: 1
  img_12460.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.472   0.      0.      0.3052  0.      0.      0.      0.2227
  0.    ]
  next best class: talking on the phone - left


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 7429
  img_100004.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.3566; nObs: 1
  img_43106.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.3566  0.      0.      0.      0.3504  0.2548  0.0383
  0.    ]
  next best class: drinking


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 4675
  img_10.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.4322; nObs: 1
  img_66664.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.4322  0.2481  0.      0.      0.      0.3193
  0.0005]
  next best class: hair and makeup


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 3906
  img_100000.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.4757; nObs: 1
  img_39147.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.4613  0.      0.      0.4757  0.      0.063   0.      0.      0.    ]
  next best class: texting - right


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 5933
  img_100001.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.4604; nObs: 1
  img_80713.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.0368  0.3452  0.      0.      0.      0.4604  0.1576  0.      0.      0.    ]
  next best class: texting - right


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 3421
  img_100012.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.3870; nObs: 1
  img_54298.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.212   0.      0.      0.      0.      0.387   0.024   0.
  0.3769]
  next best class: talking to passenger


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 5613
  img_1.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.4808; nObs: 1
  img_46770.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.      0.4808  0.245
  0.2741]
  next best class: talking to passenger


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 11917
  img_100007.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.4189; nObs: 1
  img_58521.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.0475  0.3864  0.      0.      0.      0.      0.      0.4189
  0.1472]
  next best class: talking on the phone - right


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 5113
  img_100031.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.3990; nObs: 1
  img_26146.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.     0.     0.     0.     0.     0.235  0.366  0.     0.     0.399]
  next best class: drinking

  New prediction knts:
{'kntCls': (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([ 6095,  8375, 10224,  6206,  5471,  7402,  5010,  7377, 16108,  7458]))}
  duration: 743 seconds
In [17]:
print finMdlDf
           id  lrnRateTfw  nObsFit  nStepsTfw    accVld  \
0  LgtRgr.tfw        10.0    22424     1000.0  0.987348   

                                           accVldCls  logLossVld  \
0  {u'accCls': [0.989669421488, 0.991631799163, 0...    0.193149   

                                       logLossVldCls  \
0  {u'logLossCls': [0.0123335882818, 0.0241534716...   

                                             predNew  \
0  {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   

                                               model  duration  
0  <tensorflow.python.client.session.Session obje...       743  
In [18]:
glbMdlDf = glbMdlDf.append(finMdlDf)
glbMdlDf = glbMdlDf.set_index(['id'] + srchParamsDct.keys(), drop = False)
glbMdlDf = glbMdlDf.sort_values(
                ['nObsFit', 'accVld', 'logLossVld', 'duration'], 
    ascending = [False    , True    , False,        False])
print(glbMdlDf[list(set(glbMdlDf.columns) - 
                    set(['id'] + srchParamsDct.keys()))])
                                                                                 accVldCls  \
id         nStepsTfw nObsFit lrnRateTfw                                                      
LgtRgr.tfw  1000.0   22424.0  10.0       {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.skl -1.0      22424.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   18077.0  1.0        {u'accCls': [0.326446280992, 0.209205020921, 0...   
LgtRgr.skl -1.0      18077.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   18077.0  10.0       {u'accCls': [0.504132231405, 0.435146443515, 0...   
LgtRgr.skl -1.0      15000.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   10000.0  0.1        {u'accCls': [0.169421487603, 0.144351464435, 0...   
                              1.0        {u'accCls': [0.289256198347, 0.182008368201, 0...   
LgtRgr.skl -1.0      10000.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   10000.0  10.0       {u'accCls': [0.456611570248, 0.380753138075, 0...   
LgtRgr.skl -1.0      5000.0  -1.0                                                      NaN   
                     2000.0  -1.0                                                      NaN   
LgtRgr.tfw  100.0    1000.0   0.1        {u'accCls': [0.150826446281, 0.142259414226, 0...   
                              1.0        {u'accCls': [0.423553719008, 0.182008368201, 0...   
                              10.0       {u'accCls': [0.646694214876, 0.0564853556485, ...   
LgtRgr.skl -1.0      1000.0  -1.0                                                      NaN   
                     100.0   -1.0                                                      NaN   

                                        bestFit  logLossVld  \
id         nStepsTfw nObsFit lrnRateTfw                       
LgtRgr.tfw  1000.0   22424.0  10.0          NaN    0.193149   
LgtRgr.skl -1.0      22424.0 -1.0         False    0.018463   
LgtRgr.tfw  1000.0   18077.0  1.0         False    9.475025   
LgtRgr.skl -1.0      18077.0 -1.0         False    3.116799   
LgtRgr.tfw  1000.0   18077.0  10.0         True   19.209913   
LgtRgr.skl -1.0      15000.0 -1.0         False    3.085191   
LgtRgr.tfw  1000.0   10000.0  0.1         False    8.912652   
                              1.0         False    9.502959   
LgtRgr.skl -1.0      10000.0 -1.0         False    2.885114   
LgtRgr.tfw  1000.0   10000.0  10.0        False   18.995890   
LgtRgr.skl -1.0      5000.0  -1.0         False    2.610439   
                     2000.0  -1.0         False    2.498749   
LgtRgr.tfw  100.0    1000.0   0.1         False   12.600104   
                              1.0         False   14.714048   
                              10.0        False   24.274683   
LgtRgr.skl -1.0      1000.0  -1.0         False    2.539650   
                     100.0   -1.0         False    2.497940   

                                                                                   predNew  \
id         nStepsTfw nObsFit lrnRateTfw                                                      
LgtRgr.tfw  1000.0   22424.0  10.0       {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.skl -1.0      22424.0 -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw  1000.0   18077.0  1.0                                                      NaN   
LgtRgr.skl -1.0      18077.0 -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw  1000.0   18077.0  10.0                                                     NaN   
LgtRgr.skl -1.0      15000.0 -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw  1000.0   10000.0  0.1                                                      NaN   
                              1.0                                                      NaN   
LgtRgr.skl -1.0      10000.0 -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw  1000.0   10000.0  10.0                                                     NaN   
LgtRgr.skl -1.0      5000.0  -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                     2000.0  -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw  100.0    1000.0   0.1                                                      NaN   
                              1.0                                                      NaN   
                              10.0                                                     NaN   
LgtRgr.skl -1.0      1000.0  -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                     100.0   -1.0        {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   

                                                                             logLossVldCls  \
id         nStepsTfw nObsFit lrnRateTfw                                                      
LgtRgr.tfw  1000.0   22424.0  10.0       {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.skl -1.0      22424.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   18077.0  1.0        {u'logLossCls': [1.05645327144, 1.44372530176,...   
LgtRgr.skl -1.0      18077.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   18077.0  10.0       {u'logLossCls': [1.72596805748, 1.7853875361, ...   
LgtRgr.skl -1.0      15000.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   10000.0  0.1        {u'logLossCls': [1.11536194976, 1.25718941188,...   
                              1.0        {u'logLossCls': [1.14059053163, 1.46723165909,...   
LgtRgr.skl -1.0      10000.0 -1.0                                                      NaN   
LgtRgr.tfw  1000.0   10000.0  10.0       {u'logLossCls': [1.84540699409, 1.93896956479,...   
LgtRgr.skl -1.0      5000.0  -1.0                                                      NaN   
                     2000.0  -1.0                                                      NaN   
LgtRgr.tfw  100.0    1000.0   0.1        {u'logLossCls': [1.47411393905, 2.08387227918,...   
                              1.0        {u'logLossCls': [0.842354858019, 1.17531354279...   
                              10.0       {u'logLossCls': [1.28781316316, 3.51519487621,...   
LgtRgr.skl -1.0      1000.0  -1.0                                                      NaN   
                     100.0   -1.0                                                      NaN   

                                           accVld  duration  \
id         nStepsTfw nObsFit lrnRateTfw                       
LgtRgr.tfw  1000.0   22424.0  10.0       0.987348       743   
LgtRgr.skl -1.0      22424.0 -1.0        1.000000       874   
LgtRgr.tfw  1000.0   18077.0  1.0        0.320221       519   
LgtRgr.skl -1.0      18077.0 -1.0        0.343685       597   
LgtRgr.tfw  1000.0   18077.0  10.0       0.375201       519   
LgtRgr.skl -1.0      15000.0 -1.0        0.342535       514   
LgtRgr.tfw  1000.0   10000.0  0.1        0.251208       295   
                              1.0        0.319991       301   
LgtRgr.skl -1.0      10000.0 -1.0        0.358638       317   
LgtRgr.tfw  1000.0   10000.0  10.0       0.384173       288   
LgtRgr.skl -1.0      5000.0  -1.0        0.363699       150   
                     2000.0  -1.0        0.341385        55   
LgtRgr.tfw  100.0    1000.0   0.1        0.173453         5   
                              1.0        0.255809         5   
                              10.0       0.273522         7   
LgtRgr.skl -1.0      1000.0  -1.0        0.333333        28   
                     100.0   -1.0        0.307108         8   

                                                                                     model  
id         nStepsTfw nObsFit lrnRateTfw                                                     
LgtRgr.tfw  1000.0   22424.0  10.0       <tensorflow.python.client.session.Session obje...  
LgtRgr.skl -1.0      22424.0 -1.0                                                      NaN  
LgtRgr.tfw  1000.0   18077.0  1.0                                                      NaN  
LgtRgr.skl -1.0      18077.0 -1.0                                                      NaN  
LgtRgr.tfw  1000.0   18077.0  10.0                                                     NaN  
LgtRgr.skl -1.0      15000.0 -1.0                                                      NaN  
LgtRgr.tfw  1000.0   10000.0  0.1                                                      NaN  
                              1.0                                                      NaN  
LgtRgr.skl -1.0      10000.0 -1.0                                                      NaN  
LgtRgr.tfw  1000.0   10000.0  10.0                                                     NaN  
LgtRgr.skl -1.0      5000.0  -1.0                                                      NaN  
                     2000.0  -1.0                                                      NaN  
LgtRgr.tfw  100.0    1000.0   0.1                                                      NaN  
                              1.0                                                      NaN  
                              10.0                                                     NaN  
LgtRgr.skl -1.0      1000.0  -1.0                                                      NaN  
                     100.0   -1.0                                                      NaN  
In [19]:
myexportDf(glbMdlDf, 
           save_filepathname = glbPickleFile['models'],
           save_drop_cols = 'model'
          )
Compressed pickle file: data/img_M_SFDD_ImgSz_64.pickle; size: 6 KB

Output submission

In [20]:
print '\n finMdl:'
glbwriteSubmission(glbINew, finYNewPby, 
    'img_03_fit_lgtRgr_Tfw_SFDD_ImgSz_' + str(glbImg['size']) + \
                   '_sbmt_fin.csv')
 finMdl:
                           img            c0   c1            c2            c3  \
img                                                                             
img_1.jpg            img_1.jpg  0.000000e+00  0.0  4.523997e-22  0.000000e+00   
img_10.jpg          img_10.jpg  0.000000e+00  0.0  0.000000e+00  1.000000e+00   
img_100.jpg        img_100.jpg  1.000000e+00  0.0  0.000000e+00  6.839675e-24   
img_1000.jpg      img_1000.jpg  3.653086e-23  0.0  2.392649e-37  0.000000e+00   
img_100000.jpg  img_100000.jpg  0.000000e+00  0.0  0.000000e+00  2.044043e-26   

                          c4   c5        c6   c7            c8            c9  
img                                                                           
img_1.jpg       3.088292e-35  0.0  0.000000  1.0  0.000000e+00  0.000000e+00  
img_10.jpg      0.000000e+00  0.0  0.000000  0.0  0.000000e+00  0.000000e+00  
img_100.jpg     0.000000e+00  0.0  0.000000  0.0  0.000000e+00  2.938211e-22  
img_1000.jpg    1.649245e-10  0.0  0.000288  0.0  9.997124e-01  6.012251e-29  
img_100000.jpg  1.000000e+00  0.0  0.000000  0.0  4.074502e-12  0.000000e+00  
                         img            c0        c1            c2  \
img                                                                  
img_99994.jpg  img_99994.jpg  2.072772e-16  0.528752  0.000000e+00   
img_99995.jpg  img_99995.jpg  0.000000e+00  0.000000  9.810117e-06   
img_99996.jpg  img_99996.jpg  5.345507e-38  0.995826  4.157652e-03   
img_99998.jpg  img_99998.jpg  0.000000e+00  0.000000  1.469533e-31   
img_99999.jpg  img_99999.jpg  0.000000e+00  0.000006  0.000000e+00   

                         c3            c4            c5            c6  \
img                                                                     
img_99994.jpg  0.000000e+00  1.848669e-30  6.403736e-16  1.599651e-38   
img_99995.jpg  0.000000e+00  2.588511e-11  0.000000e+00  3.520778e-09   
img_99996.jpg  5.683249e-18  1.584882e-05  0.000000e+00  0.000000e+00   
img_99998.jpg  0.000000e+00  0.000000e+00  0.000000e+00  1.000000e+00   
img_99999.jpg  0.000000e+00  0.000000e+00  0.000000e+00  9.999939e-01   

                         c7            c8            c9  
img                                                      
img_99994.jpg  2.111904e-17  4.712480e-01  4.350783e-19  
img_99995.jpg  0.000000e+00  4.449356e-02  9.554967e-01  
img_99996.jpg  0.000000e+00  9.232843e-12  0.000000e+00  
img_99998.jpg  1.277579e-33  0.000000e+00  0.000000e+00  
img_99999.jpg  0.000000e+00  6.424852e-08  0.000000e+00  

exporting 79726 rows to img_03_fit_lgtRgr_Tfw_SFDD_ImgSz_64_sbmt_fin.csv...
In [24]:
prtStr = 'LeaderBoard metric for this sel submission: %0.5f vs. ' + \
        'logLossVld (sel): %0.5f'
print prtStr % (20.00136, 19.2099)
prtStr = 'LeaderBoard metric for this fin submission: %0.5f vs. ' + \
        'logLossVld (fin): %0.5f'
print prtStr % (18.99503, 0.193149)
print 'Best score yet:%s: %0.5f' % \
    ('img_02_fit_lgtRgr(Skl)_SFDD_(ImgSz_32_)sbmt(_fin).csv', 2.63892)
LeaderBoard metric for this sel submission: 20.00136 vs. logLossVld (sel): 19.20990
LeaderBoard metric for this fin submission: 18.99503 vs. logLossVld (fin): 0.19315
Best score yet:img_02_fit_lgtRgr(Skl)_SFDD_(ImgSz_32_)sbmt(_fin).csv: 2.63892

Stop here

Following code should be in img04_fit_lgtRgrSGDTf

Let's now switch to stochastic gradient descent training instead, which is much faster.

The graph will be similar, except that instead of holding all the training data into a constant node, we create a Placeholder node which will be fed actual data at every call of sesion.run().

In [6]:
import pandas as pd
models = pd.DataFrame({'nRELUs': [0]})
#models.ix[0, 'accuracy_scoreTest'] = 0
print models
   nRELUs
0       0
In [7]:
batch_size = 128

graph = tf.Graph()
with graph.as_default():

  # Input data. For the training data, we use a placeholder that will be fed
  # at run time with a training minibatch.
  tfwObsFitFtr = tf.placeholder(tf.float32,
                                    shape=(batch_size, glbImg['size'] * glbImg['size']))
  tfwObsFitRsp = tf.placeholder(tf.float32, shape=(batch_size, glbRspClassN))
  tfwObsVldFtr = tf.constant(glbXVld)
  tfwObsNewFtr = tf.constant(glbXNew)
  
  # Variables.
  tfwW = tf.Variable(
    tf.truncated_normal([glbImg['size'] * glbImg['size'], glbRspClassN]))
  tfwB = tf.Variable(tf.zeros([glbRspClassN]))
  print(tfwW.initialized_value())
  print(tfwB.initialized_value())    
  
  # Training computation.
  logits = tf.matmul(tfwObsFitFtr, tfwW) + tfwB
  loss = tf.reduce_mean(
    tf.nn.softmax_cross_entropy_with_logits(logits, tfwObsFitRsp))
  
  # Optimizer.
  optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)
  
  # Predictions for the training, validation, and test data.
  tfwObsTrnPred = tf.nn.softmax(logits)
  tfwObsVldPred = tf.nn.softmax(
    tf.matmul(tfwObsVldFtr, tfwW) + tfwB)
  tfwObsNewPred = tf.nn.softmax(tf.matmul(tfwObsNewFtr, tfwW) + tfwB)
Tensor("Identity:0", shape=TensorShape([Dimension(784), Dimension(10)]), dtype=float32)
Tensor("Identity_1:0", shape=TensorShape([Dimension(10)]), dtype=float32)

Let's run it:

In [8]:
nStepsTfw = 3001

with tf.Session(graph=graph) as session:
  tf.initialize_all_variables().run()
  print("Initialized")
  for step in range(nStepsTfw):
    # Pick an offset within the training data, which has been randomized.
    # Note: we could use better randomization across epochs.
    offset = (step * batch_size) % (glbYFit.shape[0] - batch_size)
    # Generate a minibatch.
    batch_data = glbXFit[offset:(offset + batch_size), :]
    batch_labels = glbYFit[offset:(offset + batch_size), :]
    # Prepare a dictionary telling the session where to feed the minibatch.
    # The key of the dictionary is the placeholder node of the graph to be fed,
    # and the value is the numpy array to feed to it.
    feed_dict = {tfwObsFitFtr : batch_data, tfwObsFitRsp : batch_labels}
    _, l, predictions = session.run(
      [optimizer, loss, tfwObsTrnPred], feed_dict=feed_dict)
    if (step % 500 == 0):
      print("Minibatch loss at step %d: %f" % (step, l))
      print("Minibatch accuracy_score: %.1f%%" % accuracy_score(predictions, batch_labels))
      print("Validation accuracy_score: %.1f%%" % accuracy_score(
        tfwObsVldPred.eval(), glbYVld))
  print("Test accuracy_score: %.1f%%" % accuracy_score(tfwObsNewPred.eval(), glbYNew))
  models.ix[0, 'accuracy_scoreVld'] = accuracy_score(tfwObsVldPred.eval(), glbYVld)
  models.ix[0, 'accuracy_scoreTst'] = accuracy_score( tfwObsNewPred.eval(),  glbYNew)
Initialized
Minibatch loss at step 0: 17.272371
Minibatch accuracy: 6.2%
Validation accuracy: 13.0%
Minibatch loss at step 500: 1.435902
Minibatch accuracy: 76.6%
Validation accuracy: 75.2%
Minibatch loss at step 1000: 1.280029
Minibatch accuracy: 78.1%
Validation accuracy: 77.2%
Minibatch loss at step 1500: 1.147653
Minibatch accuracy: 77.3%
Validation accuracy: 77.2%
Minibatch loss at step 2000: 1.262677
Minibatch accuracy: 72.7%
Validation accuracy: 77.9%
Minibatch loss at step 2500: 0.777248
Minibatch accuracy: 83.6%
Validation accuracy: 77.3%
Minibatch loss at step 3000: 1.085464
Minibatch accuracy: 77.3%
Validation accuracy: 78.6%
Test accuracy: 86.1%
In [9]:
models.ix[0, 'graph'] = graph
print(models)
   nRELUs  accuracyVld  accuracyTst  \
0       0        78.57    86.098056   

                                               graph  
0  <tensorflow.python.framework.ops.Graph object ...  

Problem

Turn the logistic regression example with SGD into a 1-hidden layer neural network with rectified linear units (nn.relu()) and 1024 hidden nodes. This model should improve your validation / test accuracy_score.


In [10]:
nRELUs = [2 ** thsRelu for thsRelu in xrange(11)]
print(nRELUs)
for thsRelu in nRELUs:
    models.ix[thsRelu, 'nRELUs'] = thsRelu

print models
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
      nRELUs  accuracyVld  accuracyTst  \
0          0        78.57    86.098056   
1          1          NaN          NaN   
2          2          NaN          NaN   
4          4          NaN          NaN   
8          8          NaN          NaN   
16        16          NaN          NaN   
32        32          NaN          NaN   
64        64          NaN          NaN   
128      128          NaN          NaN   
256      256          NaN          NaN   
512      512          NaN          NaN   
1024    1024          NaN          NaN   

                                                  graph  
0     <tensorflow.python.framework.ops.Graph object ...  
1                                                   NaN  
2                                                   NaN  
4                                                   NaN  
8                                                   NaN  
16                                                  NaN  
32                                                  NaN  
64                                                  NaN  
128                                                 NaN  
256                                                 NaN  
512                                                 NaN  
1024                                                NaN  
In [49]:
thsRelu = nRELUs[9]
batch_size = 128

graph = tf.Graph()
with graph.as_default():

  # Input data. For the training data, we use a placeholder that will be fed
  # at run time with a training minibatch.
  tfwObsFitFtr = tf.placeholder(tf.float32,
                                    shape=(batch_size, glbImg['size'] * glbImg['size']))
  tfwObsFitRsp = tf.placeholder(tf.float32, shape=(batch_size, glbRspClassN))
  tfwObsVldFtr = tf.constant(glbXVld)
  tfwObsNewFtr = tf.constant(glbXNew)
  
  # Variables.
  tfwW1 = tf.Variable(
    tf.truncated_normal([glbImg['size'] * glbImg['size'], thsRelu]), name = 'tfwW1')
  tfwB1 = tf.Variable(tf.zeros([thsRelu]), name = 'tfwB1')
  tfwW2 = tf.Variable(
    tf.truncated_normal([thsRelu, glbRspClassN]), name = 'tfwW2')
  tfwB2 = tf.Variable(tf.zeros([glbRspClassN]), name = 'tfwB2')
  print(tfwW1.initialized_value())
  print(tfwB1.initialized_value())
  #print(relus.initialized_value())
  print(tfwW2.initialized_value())
  print(tfwB2.initialized_value())
  #tf.Print(relus, [relus])  
     
  # Training computation.
  layer1 = tf.matmul(tfwObsFitFtr, tfwW1) + tfwB1
  layer2 = tf.nn.relu(layer1)
  layer3 = tf.matmul(layer2, tfwW2) + tfwB2
  loss = tf.reduce_mean(
    tf.nn.softmax_cross_entropy_with_logits(layer3, tfwObsFitRsp))
  
  # Optimizer.
  optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)
  
  # Predictions for the training, validation, and test data.
  tfwObsTrnPred = tf.nn.softmax(layer3)
  tfwObsVldPred = tf.nn.softmax(
    tf.matmul(tf.nn.relu(tf.matmul(tfwObsVldFtr, tfwW1) + tfwB1), tfwW2) + tfwB2)
  tfwObsNewPred = tf.nn.softmax(
    tf.matmul(tf.nn.relu(tf.matmul(tfwObsNewFtr, tfwW1) + tfwB1), tfwW2) + tfwB2)
Tensor("Identity:0", shape=TensorShape([Dimension(784), Dimension(512)]), dtype=float32)
Tensor("Identity_1:0", shape=TensorShape([Dimension(512)]), dtype=float32)
Tensor("Identity_2:0", shape=TensorShape([Dimension(512), Dimension(10)]), dtype=float32)
Tensor("Identity_3:0", shape=TensorShape([Dimension(10)]), dtype=float32)
In [50]:
nStepsTfw = 3001

with tf.Session(graph=graph) as session:
  tf.initialize_all_variables().run()
  print("Initialized")
  for step in range(nStepsTfw):
    # Pick an offset within the training data, which has been randomized.
    # Note: we could use better randomization across epochs.
    offset = (step * batch_size) % (glbYFit.shape[0] - batch_size)
    # Generate a minibatch.
    batch_data = glbXFit[offset:(offset + batch_size), :]
    batch_labels = glbYFit[offset:(offset + batch_size), :]
    # Prepare a dictionary telling the session where to feed the minibatch.
    # The key of the dictionary is the placeholder node of the graph to be fed,
    # and the value is the numpy array to feed to it.
    feed_dict = {tfwObsFitFtr : batch_data, tfwObsFitRsp : batch_labels}
    _, l, predictions = session.run(
      [optimizer, loss, tfwObsTrnPred], feed_dict=feed_dict)
    if (step % 500 == 0):
      print("Minibatch loss at step %d: %f" % (step, l))
      print("Minibatch accuracy_score: %.1f%%" % accuracy_score(predictions, batch_labels))
      print("Validation accuracy_score: %.1f%%" % accuracy_score(
        tfwObsVldPred.eval(), glbYVld))
  print("Test accuracy_score: %.1f%%" % accuracy_score(tfwObsNewPred.eval(), glbYNew))
  models.ix[thsRelu, 'accuracy_scoreVld'] = accuracy_score(tfwObsVldPred.eval(), glbYVld)
  models.ix[thsRelu, 'accuracy_scoreTst'] = accuracy_score( tfwObsNewPred.eval(),  glbYNew)
  models.ix[thsRelu, 'graph'] = graph
  print(models)
Initialized
Minibatch loss at step 0: 235.251495
Minibatch accuracy: 14.1%
Validation accuracy: 23.9%
Minibatch loss at step 500: 15.635325
Minibatch accuracy: 72.7%
Validation accuracy: 77.7%
Minibatch loss at step 1000: 5.719280
Minibatch accuracy: 83.6%
Validation accuracy: 78.3%
Minibatch loss at step 1500: 3.931793
Minibatch accuracy: 76.6%
Validation accuracy: 75.8%
Minibatch loss at step 2000: 3.211185
Minibatch accuracy: 75.0%
Validation accuracy: 78.1%
Minibatch loss at step 2500: 1.988469
Minibatch accuracy: 80.5%
Validation accuracy: 78.0%
Minibatch loss at step 3000: 3.435107
Minibatch accuracy: 77.3%
Validation accuracy: 79.1%
Test accuracy: 86.7%
      nRELUs  accuracyVld  accuracyTst  \
0          0        78.57    86.098056   
1          1        19.29    19.750053   
2          2        36.26    40.087588   
4          4        64.67    71.122623   
8          8        75.80    82.861568   
16        16        79.74    86.685537   
32        32        76.77    84.287545   
64        64        78.79    86.172826   
128      128        78.86    86.210211   
256      256        79.21    86.407819   
512      512        79.12    86.674856   
1024    1024        81.26    88.335826   

                                                  graph  
0     <tensorflow.python.framework.ops.Graph object ...  
1     <tensorflow.python.framework.ops.Graph object ...  
2     <tensorflow.python.framework.ops.Graph object ...  
4     <tensorflow.python.framework.ops.Graph object ...  
8     <tensorflow.python.framework.ops.Graph object ...  
16    <tensorflow.python.framework.ops.Graph object ...  
32    <tensorflow.python.framework.ops.Graph object ...  
64    <tensorflow.python.framework.ops.Graph object ...  
128   <tensorflow.python.framework.ops.Graph object ...  
256   <tensorflow.python.framework.ops.Graph object ...  
512   <tensorflow.python.framework.ops.Graph object ...  
1024  <tensorflow.python.framework.ops.Graph object ...  
In [52]:
plt.figure()
#plt.plot(models['nRELUs'], models['accuracy_score.fit'], 'bo-', label = 'fit')
plt.plot(models['nRELUs'], models['accuracy_scoreVld'], 'rs-', label = 'vld')
plt.plot(models['nRELUs'], models['accuracy_scoreTst'], 'gp-', label = 'new')
plt.legend(loc = 'lower right')
plt.title("accuracy_score")
plt.xscale('symlog', basex=2)
axes = plt.gca()
axes.set_xlabel('nRELUs')
# axes.set_xlim([mdlDF['l1_penalty'][mdlDF['RSS.vld'].argmin()] / 10 ** 2, \
#                mdlDF['l1_penalty'][mdlDF['RSS.vld'].argmin()] * 10 ** 2])
# axes.set_ylim([0, mdlDF['RSS.vld'].min() * 1.5])
plt.show()
In [ ]: